In this walkthrough, we've outlined how keying can be used in After Effects to "remove" certain colors from your shot (such as a green screen background), and then replace the colored area with new visuals.
What is Keying in After Effects?
Essentially, keying (or chroma keying) is selecting a specific color value in a shot, and then making any pixels with that value (or similar values) transparent. Green screens all use some form of keying, but the background doesn't have to be green for the effect to work. In fact, some of the most acclaimed special effects teams use magenta screens, and blue and red are fairly common as well.
If you're only keying out the background of a clip, you can also use a technique called difference keying. This compares your original shot with another frame that just contains the background, and then makes the background pixels transparent. To get quality results, you need to make sure that your shot doesn't have too much noise or graininess, because that can make it difficult for After Effects to "key out" the entire background.
Here are a few of the most useful keying effects:
- Keylight: Green and blue screen keying algorithm, which comes bundled with After Effects Professional Edition and is used on Academy Award-winning films. If you have Keylight installed, many of the other color effects will be redundant or less effective.
- Color Difference: Divides the frame into two matte images. The B matte creates transparency on areas that contain the key color, and the A matte creates transparency on areas that don't contain a second color, unrelated to the first. Then, the two mattes are combined to produce precise transparency results.
- Color Range: Selects a specific range of colors and keys them out. This can be useful on an uneven background, or a background with multiple colors.
- Difference Matte: Compares a source layer with another layer (called a difference layer), and then keys out everything in the source layer that isn't present in the difference layer. This is a highly effective way to key out a static background, while still retaining your subject.
- Extract: Instead of removing colors, this effect keys out a brightness range, which is useful for black-and-white shots and highly exposed backgrounds. Using a built-in histogram, you can specify which brightness values to adjust, ranging from 0 (darkest) to 255 (brightest).
- Inner/Outer Key: By creating a mask in After Effects, you can isolate a section of your frame (such as an object) and key it out, as well as any similar background colors around the mask's border.