Are your matte edges crunchy, chewy, contrasty, solid, sizzling? Do these terms even mean anything to you? They will by the time Mark Christiansen finishes showing you how to work with After Effects CS3 color keying.

Color keying was first devised in the 1950s as a clever means to combine live-action foreground footage and backgrounds that could come from virtually anywhere. As of 2007, the tools to do color keying are more powerful than ever, but the overall process still remains full of pitfalls—which likely won't be overcome until some other means evolves to define precise areas of transparency in foreground footage. (Several contenders are in some form of development.)

The process goes by many names: color keying, bluescreening, greenscreening, pulling a matte, color differencing—even chroma keying, a term that really belongs to analog color television, a medium defined by chroma and heavily populated with weather forecasters.

The purpose of this article is to help you not only with color keying of bluescreen and greenscreen footage, but with all cases in which pixel values (hue, saturation, and/or brightness) stand in for transparency, allowing compositors to separate foreground from background based on color data.

All of these methods extract luminance information, which is then applied to the alpha channel of a layer (or layers). The black areas become transparent, the white areas opaque, and the gray areas gradations of semi-opacity; the handling of these gray areas typically determines the success or failure of a matte.

NOTE

Novices often wonder if a background must be blue or green to be keyed. The answer is no, although specialized tools such as Keylight work with only the digital primaries red, green, or blue. It also happens that blue and green are primary colors not dominant in human skin tones, and most foreground elements (costumes and props), while they might be blue or green, tend to be less purely so. (That's the hope, anyhow.)

Good Habits and Best Practices

Before we get into detail about specific keying methods and when to use them, here's some top-level advice to remember when creating any kind of matte:

Use a bright, saturated, contrasting background. Press Ctrl-Shift-B (Mac: Command-Shift-B) and apply a background color such as yellow, red, orange, or purple (see Figure 1). If the foreground is to be added to a dark scene, a dark shade is okay, but in most cases bright colors better reveal matte problems. Solo the foreground over the background you choose (see Figure 2).

Protect edge detail. This is the name of the game, and the focus of much of this article; the key to winning is to isolate edges as much as possible and focus just on them, in order to avoid crunchy, chewy mattes (see Figure 3).

Figure 1 The background influences what you see. Against black, almost no detail is visible (left). Checkerboard reveals shadows (center), but flaws in the matte are clearest with a bright, solid, contrasting background (right). (Source footage courtesy of Pixel Corps.)

Figure 2 The keyed layer can be soloed at any time, revealing it against the background of your choice.

Figure 3 A coyote ugly, chewy matte (this one exaggerated for effect) is typically the result of clamping the foreground or background (or both) too far.

Keep it simple and be willing to start over. Artists spend hours on keys that could more effectively be redone in minutes, simply by beginning in the right place. Many complex and interdependent steps are involved with creating a key; if you start to feel cornered, don't stay there.

Constantly scan frames and zoom into detail. When possible, start with a tricky area of a difficult frame; look for motion blur, fine detail, excessive color spill, and so on, and keep checking various areas in various modes (see Figure 4).

Break it down into multiple passes. This is the single most important concept overlooked by beginners. In the vast majority of cases, a successful matte incorporates at least two passes: a core matte whose foreground is 100% opaque, and a second edge pass.

Figure 4 A glimpse of the alpha channel can reveal even more problems, such as faint holes in the foreground, which should be solid white. This is the matte from Figure 1.

I encourage you to review this list again once you've explored the rest of this article.