Blending Modes: The Real Deal
After Effects includes 34 blending modes, each created with a specific purpose ( Figure 3.22 )—although no one is quite sure in what context Dancing Dissolve was ever useful (and I'm only half joking). For effects work, moreover, the majority of them are not particularly recommended. In fact, traditional optical compositing would effectively include only two of them: Add and Multiply.
Figure 3.22 With 34 blending modes to choose from, it's virtually guaranteed that less experienced users will be easily overwhelmed and compelled to play hunt and peck. You will likely use a small subset of these 90% of the time.
So that's it? Use these two or none at all? Not quite—I'll point out a few other useful modes as well. Once you understand how your options work, you can make informed compositing decisions, rather than lazily playing Go Fish by trying one mode after the other until you see something you kind of like.
Remember, blending modes are all based on mathematical operations for combining pixels in the layer containing the given blending mode and the pixels behind it—either below it in the stack, if all the layers are 2D, or positioned behind it in 3D space, if all the layers are 3D.
To help you understand what the various blending modes are doing, Figures 3.24 through 3.30 blend a grayscale gradient over a fully saturated background. Contextual examples using these blending modes follow in the next section.
Figure 3.24 Compare Figures 3.25 through 3.30 to this one, which shows a black-to-white gradient (created using the Ramp effects) over a gradient of fully bright and saturated color. Blending in this figure is set to Normal.
Figure 3.25 The same combination with Add mode applied to the foreground layer. Each background pixel is lightened by the brightness of the foreground pixel up to a value of full white (1.0). The darker the foreground pixel, the less the visibility. Figure 3.31c shows Add using photographed elements.
Figure 3.26 Screen mode is an attenuated Add, pushing fewer values to full white. Figure 3.32 further illustrates the difference between Screen and Add (Figure 3.31c).
Figure 3.27 Multiply mode sends values toward 0.0, or full black. This is the equivalent of laying one frame of film over the other (a.k.a. "bi-packing"); the resulting combination is darker as the denser (darker) areas are built up. A practical example is shown in Figure 3.33.
Figure 3.28 Overlay combines Screen and Multiply; areas of the background below 50% brightness are multiplied, those above 50% are screened. A practical example is shown in Figure 3.34.
Figure 3.29 Hard Light is the inverse of Overlay; areas of the foreground below 50% brightness are multiplied, those above 50% are screened.
Figure 3.30 Difference bases the luminance of the foreground pixels on the amount of difference between the foreground and background source; the greater the difference, the brighter the value. Practical usage of Difference is demonstrated in Figure 3.36.
Add and Screen
Add and Screen modes both brighten the image. Screen typically yields a subtler effect than Add, which results in brighter values overall.
Add mode is every bit as simple as it sounds; the formula is
newPixel = A + B
where A is a pixel from the foreground layer and B is a background pixel (although they are obviously interchangeable in this formula). The result is clipped at 1 for 8- and 16-bit pixels (but can exceed 1 in 32 bpc mode); any pixels that add up to a value of more than 1 take the value of 1, full white.
In 32 bpc mode, this is likely to be your most commonly used blending mode. It generally brightens the overall image, but any black in the foreground acts transparent by adding a value of 0 to the background. It is useful for laying fire and explosion elements shot in negative space (against black) into a scene, adding noise or grain to an element, or any other element that is made up of light and texture ( Figures 3.31a , b , and c ).
Figures 3.31a, b, and c Add mode takes the source foreground element, the fire shot against a black background shown in 3.31a, and adds its pixel values channel by channel to the background (b), causing the pure black pixels to disappear completely (c).
Screen mode has an influence similar to Add mode's, but via a slightly different formula. The pixel values are inverted, multiplied together, and the result is inverted:
newPixel = 1–((1–A) * (1–B))
Note that with this formula, fully white pixels stay white, fully black pixels stay black, but a midrange pixel (0.5) takes on a brighter value (0.75), just not as bright as would be with Add (1).
You use Screen much like Add when working in 8 bpc and 16 bpc modes. Screen is most useful in situations where Add would blow out the highlights too much—glints, flares, glow passes, and so on ( Figure 3.32 ).
Figure 3.32 The difference between Screen and Add (Figure 3.31) may be subtle in printed figures until you look closely; notice there's less brightness in the "hottest" areas of the fire.
Multiply is another mode that is as simple as it sounds; it uses the formula
newPixel = A * B
This would seem to make the values much higher until you recollect that we are calculating values between 0 and 1; when you multiply by a fraction, the result is lower than the source value. Multiplying two images together, therefore, actually has the effect of reducing midrange pixels and darkening an image overall, although pixels that are full white in both images remain full white.
In optical compositing (the crude method used to do this stuff photochemically before we had computers that could manage it) the equivalent of multiply was layering two images, one over the other, combining their densities such that the dark areas of each image held out light from the other. This process was known as bi-packing.
Multiply literally has the inverse effect of Screen mode, darkening the midrange values of one image with another. It is useful in cases where you wish to emphasize dark tones in the foreground without replacing the lighter tones in the background, for example to layer in texture, shadow, or dark fog ( Figure 3.33 ).
Figure 3.33 Dark smoke (actually a grayscale fractal noise pattern) is multiplied over the background, darkening the areas that are dark in either the foreground or background further.
Overlay and the Light Modes
Overlay uses the bottom layer to determine whether to screen or multiply. Above a threshold of 50% gray (or .5 in normalized terms), it is screened. Below 50%, it is multiplied. Hard Light operates similarly, instead using the top layer to determine whether to screen or multiply, so the two are inverse effects. Reversing layer order and swapping Overlay for Hard Light yields an identical result.
These modes, along with Linear and Vivid Light, can be most useful for combining a layer that is predominantly color with another layer that is predominantly luminance, or contrast detail ( Figure 3.34 ). This is how you create textures; for example, some of the lava texturing in the Level 4 sequence of Spy Kids 3–D was created by using Hard Light to combine a hand-painted color heat map with moving fractal noise patterns.
Figure 3.34 Overlay and its inverse, Hard Light, are useful for combining color and texture. Here, an instant lava lamp texture was created using the components shown at the right: a solid with Fractal Noise applied set to Overlay mode on top of a red-to-yellow gradient.
This type of usage is fine in 8 bpc or 16 bpc projects, but try to avoid fishing in the various Light modes when combining more detailed and specific elements. These methods don't work properly with 32 bpc overbright levels (explored in Chapter 11), and this method of adjusting images is a warning sign that you haven't thought things through in terms of what you're trying to do.
Difference is a subtraction mode that inverts a pixel in the background according to how bright the foreground pixel is. There is one very specific use for Difference that has nothing to do with creating a blended look: You can line up two identical layers using this mode. When all of the pixels line up properly, layer details disappear ( Figure 3.35 ).
Figure 3.35 Difference mode can help you line up two layers that were shot at the same time, from the same camera setup. You know that the two layers are perfectly lined up when all of the pixels turn black.
HSB and Color Modes
The Hue, Saturation, and Brightness modes each combine the given value from the foreground layer with the other two from the background layer. Saturation applies the foreground saturation to the background hue and luminance values, Hue combines the foreground hue with the background saturation and luminance, and Brightness uses the foreground luminance in combination with the hue and saturation of the background.
Color takes both the hue and saturation of the top layer, using only the luminance from the underlying background ( Figure 3.36 ).
Figure 3.36 Setting a deep-blue-colored solid to Color mode and overlaying it on the plate footage has the effect of tinting the colors in the image blue. Artistic uses of this mode are explored in Chapter 12, "Working with Light."
Keep these modes in mind as shortcuts to channel operations in which you might want the color from a foreground combined with the detail (luminance) of the existing background.
Stencil and Silhouette
The Stencil and Silhouette blending modes apply transparency information to all of the layers below them in the composition. The Stencil modes use the light pixels, and Silhouette the dark pixels, of either the Alpha or Luminance values to determine the areas that remain visible in the layers below the current layer. You can keep these in mind for occasions in which they save you extra setup work.
Alpha Add and Luminescent Premultiply
Alpha Add and Luminescent Premultiply are special-case blending modes that affect semi-transparent edge pixels only.
Have you ever tried matting a layer with an alpha channel over the same layer with the alpha channel inverted? Figures 3.37a through d show the typical result: a semi-opaque line tracing the edge of the alpha, where the pixels remain semi-transparent because they are blended together in the same manner as semi-opaque layers. Alpha Add adds the actual values of the alpha pixels without compensating for the opacity effect, so two 50% opaque pixels become 100% opaque.
Figures 3.37a through d Placing a matted object over a background with the exact inverse matte (a, b) seems as though it should result in a fully opaque image. Instead, edge pixels form a semi-transparent halo in the alpha channel (c). Alpha Add does just what the title implies, adding the alpha values together so that inverse mattes total up to 100% throughout the image (d) (left to right).
Why would you combine a layer with itself, inverting the alpha? You probably wouldn't. But you might combine two layers with overlapping transparency that would require this method—for example, two parts of the same layer.
Luminescent Premultiply is an alternative method of removing premultiplication from source footage, retaining bright values that would otherwise be clipped. Premultiplication over black causes all semi-transparent pixels to become darker; removing the black values while adding transparency, which is what removing premultiplication does, can cause them to appear dimmer than they should. This is useful for bright overlaid elements that come in with alpha channels and premultiplication, such as flares and explosions; you can set the footage to interpret as Straight on import and use this mode instead of Normal to overlay the element. It's another trick to keep in your arsenal should you ever see the symptoms (dim translucent elements) for which it is recommended.