Color Keying in After Effects CS3
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.
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.
I encourage you to review this list again once you've explored the rest of this article.