Layer styles, part 3
Previous installments in my Layer Styles series showed how to create layer outlines and drop shadows in Conduit. This time I’ll look into two very similar layer effects that Photoshop calls “Inner Shadow” and “Inner Glow”. They preserve the original alpha (transparency) of the layer, applying the effect only on the layer image.
Inner Shadow is a simple variant of the Drop Shadow effect that we built previously. Let’s try it on this simple one-layer composite:

With inner shadow applied…

The conduit for this effect looks like this:

The 2D Transform node is used to move the image towards the bottom right. That determines the “light direction” — the imaginary light casting this shadow is in the opposite direction, on the top left. Then, a Separate RGBA node is used to extract the alpha, and it’s blurred with a Gaussian Blur. Familiar territory so far. (The MinMax node is disabled, but will get used soon enough.) The offsetted-and-blurred alpha looks like this:

This image is multiplied over the original image, which applies the shadow. Finally, there’s the crucial Set Matte node, which is used to restore the alpha of the shadowed image to that of the original image. The last node is a plain old Over to composite this layer over the background.
The inner shadow may not be terribly exciting, but it offers a good opportunity to extol Conduit’s pervasive floating-point capabilities. Here’s a variant where the the image is brightened before applying the shadow. Also, the shadow is not offset with a 2D Transform, but rather shrunk with a 2D Min node. This results in a look where the shadow follows the outlines of the layer (this is effectively the same as Photoshop’s Inner Glow with blending mode set to Multiply):

Notice how color and detail is preserved in the bright areas that were blown out and then darkened by the shadow? For comparison, the following image shows what the effect looks like if the brightened image is clipped. This is the result you get in a compositor that doesn’t support floating-point color:

(Technology insight interlude: many video/graphics editing and compositing packages don’t support floating-point color at all. Those that do usually have a separate floating-point mode, and users avoid using floating-point color unless absolutely necessary because it entails heavy performance hit and more limited features; e.g. many Photoshop and After Effects filters are disabled in floating-point mode. In contrast, Conduit simply defaults to floating-point — you need to explicitly enable clipping in a node if you don’t want high dynamic range color. We can afford to do this because the core of Conduit is a highly efficient concatenation engine that breaks down the conduit into optimized GPU programs. Expensive memory bus traffic is minimized as the pixel data is kept in high-precision GPU registers as long as possible. That’s how Conduit can do realtime HD playback with effects that might take something like 10 seconds per frame to render in a previous-generation compositor like Shake. Now back to the tutorial…)
Instead of just a black shadow, we might want to colorize it. That’s pretty simple to accomplish: just mix a color into the shadow image (the blurred alpha). We’ll use a Screen node for this, because we want to keep the white intact in order to avoid colorizing the entire layer when the shadow is applied. Here’s the shadow image colorized using Screen:

The result image:

And the conduit:

The brightening is accomplished with a Bezier Curve node (which brings down the highlights a bit) followed by Exposure. Here are the exact settings for these nodes, in case you’re curious:

As a tiny reward for the patience you’ve shown by reading this far, here’s a glimpse into one of the new Conduit products that will be released soon. Watch this space! :)






