Keying: Lesson Overview
Keying: Lesson Overview
Keying Page 2
9 Keying
Lesson overview
In this lesson, you’ll learn how to do the following:
• Create a garbage mask.
• Use the Color Difference Key effect to key an image.
• Check an image’s alpha channel for errors in a key.
• Use the Spill Suppressor effect to remove unwanted light spill.
• Key out a background using the Keylight effect.
• Adjust the contrast of an image using the Levels effect.
In this lesson, you will build a promotional spot for a weekly
news segment on a fictional television station. You’ll begin by
working with liveaction footage of an actor captured on a green
screen stage. You will learn how to use keying effects to remove
the green background and clean up the edge of the key to remove
any lingering green spill. Then you will add a title to the promo,
and place the station ID that was created in Lesson 2 into the
composition to complete the project.
This lesson will take approximately an hour to complete.
Lesson 9. Keying
Lesson 9. Keying Page 3
278 LESSON 9
Keying
About keying
Keying is defining transparency by a particular color value (with a color key or chroma
key) or brightness value (with a luminance key) in an image. When you key out a value,
all pixels that have similar colors or luminance values become transparent.
Keying makes it easy to replace a background of a consistent color or brightness with
another image, which is especially useful when working with objects that are too
complex to mask easily. The technique of keying out a background of a consistent color
is often called bluescreening or greenscreening, although you do not have to use blue or
green; you can use any solid color for a background.
Difference keying defines transparency with respect to a particular baseline background
image. Instead of keying out a singlecolor screen, you can key out an arbitrary
background.
Why might you use keying? There are a variety of reasons, including the following:
• A stunt may be too dangerous for an actor to perform on location.
• The location may be too hazardous for cast and crew.
• In the case of sciencefiction movies, the location may not exist at all.
• You are working with a limited budget and cannot shoot any other way.
The best way to ensure a good key is to know what format works best. MiniDV is a
popular format, and you’ll use it in this lesson, but compression can cause MiniDV
footage to have artifacts such as blocky regions or aliasing along the curves and
diagonals of your subject. The greater the digital compression, the harder it is to pull a
clean key. After Effects can help you solve these and other keying problems.
You will have greater success when pulling a key in MiniDV format if your backdrop
is green instead of blue. Luminance information, which comprises 60% of the video
signal, is encoded into the green channel. The green channel is also the least compressed
of the RGB color channels. Blue, on the other hand, tends to be the noisiest channel.
Lesson 9. Keying
Lesson 9. Keying Page 4
Getting started
Make sure the following files are in the AECS3_CIB/Lessons/Lesson09 folder on
your hard disk, or copy them from the Adobe After Effects CS3 Classroom in a Book
DVD now.
• In the Assets folder: 5.ai, Channel5_logo.aep, L7BG.mov, rotatedtype.ai,
talent_DV.mov
• In the Sample_Movie folder: Lesson09.mov
1 Open and play the Lesson09.mov sample movie to see what you will create in
Lesson 9. When you are done, quit the QuickTime player. You may delete this sample
movie from your hard disk if you have limited storage space.
Setting up the project
When you begin the lesson, restore the default application settings for After Effects.
See “Restoring default preferences” on page 5.
1 Press Ctrl+Alt+Shift (Windows) or Command+Option+Shift (Mac OS) while
starting After Effects CS3 to restore default preferences settings. When asked whether
you want to delete your preferences file, click OK.
After Effects opens to display a new, untitled project.
2 Choose File > Save As.
3 In the Save As dialog box, navigate to the AECS3_CIB/Lessons/Lesson09/
Finished_Project folder.
4 Name the project Lesson09_Finished.aep, and then click Save.
Importing the footage
You need to import two footage items for this lesson.
1 Choose File > Import > File.
2 Navigate to the AECS3_CIB/Lessons/Lesson09/Assets folder. Ctrlclick (Windows)
or Commandclick (Mac OS) to select the talent_DV.mov and L7BG.mov files, and then
click Open. The footage items appear in the Project panel. You will organize them before
getting underway.
Lesson 9. Keying
Lesson 9. Keying Page 5
280 LESSON 9
Keying
3 Choose File > New > New Folder to create a new folder in the Project panel, or click
the Create A New Folder button ( ) at the bottom of the panel.
4 Type mov_files to name the folder, press Enter (Windows) or Return (Mac OS) to
accept the name, and then drag the two footage items into the mov_files folder.
5 Expand the folder so that you can see the items inside.
Creating the composition
To begin building your promotional spot, you need to create a new composition.
1 Choose Composition > New Composition or press Ctrl+N (Windows) or
Command+N (Mac OS).
2 In the Composition Settings dialog box, type Color Difference Key in the
Composition Name box.
3 Make sure the Preset popup menu is set to NTSC DV. This automatically sets the
width, height, pixel aspect ratio, and frame rate for the composition.
Lesson 9. Keying
Lesson 9. Keying Page 6
4 In the Duration field, type 800 to specify 8 seconds, which matches the length of the
Talent_DV.mov footage item, and then click OK.
After Effects opens the new composition in the Timeline and Composition panels.
Changing the background color
The default background in After Effects is black, which makes it hard to see holes
or other errors when pulling a key. So you’ll start by changing the background to
something other than black or white. In this lesson, you will use orange.
1 Choose Composition > Background Color or press Ctrl+Shift+B (Windows) or
Command+Shift+B (Mac OS).
Lesson 9. Keying
Lesson 9. Keying Page 7
282 LESSON 9
Keying
2 Click the color swatch and select a bright orange hue, such as RGB 255, 200, 0.
Then click OK to close the Color Picker, and OK again to close the Background Color
dialog box.
Instead of changing the background color, you can also click the Toggle Transparency
Grid button ( ) at the bottom of the Composition panel. This turns on a checkerboard
background that reveals transparency, which is another good way to spot errors in a key.
Adding the foreground subject
Now, you will add the Talent_DV.mov footage item to the composition.
1 Press the Home key to make sure that the currenttime indicator is at the beginning
of the time ruler.
Lesson 9. Keying
Lesson 9. Keying Page 8
2 Drag the Talent_DV.mov item from the Project panel to the Timeline panel. The
Talent_DV image appears in the foreground of the Composition panel.
This is a simple greenscreen shot. If you manually preview the shot by dragging the
currenttime indicator across the time ruler, you will notice that the actor doesn’t move
very much, which will aid in your keying. However, notice that the backdrop is not lit
evenly. The upper portion is much brighter than the lower portion. This might cause
some problems.
When After Effects pulls a key, it looks at the entire frame. The larger the area that must
be analyzed and the larger the variation in color, the greater risk that you won’t be able
to remove all of the background color. You can reduce this risk by using a garbage mask.
A garbage mask (or matte) is so named because it is used to mask out the bad, or
unnecessary, parts of the image. When you create a garbage mask for a layer, it’s a
good idea to keep it fairly loose. If the foreground subject is moving, you need to leave
enough room in the garbage mask to accommodate the motion. If you make it too tight,
you will have to animate the mask over time—and that isn’t much fun. Remember, a
garbage mask is used to help solve problems, not create new ones.
Lesson 9. Keying
Lesson 9. Keying Page 9
284 LESSON 9
Keying
Creating a garbage mask
There is no limit to the number of garbage masks you can have in a composition. In
fact, on some complex shots it is not uncommon to have multiple garbage masks isolate
limbs, faces, hair, or different subjects in the scene.
1 Press the Home key to make sure that the currenttime indicator is at the beginning
of the time ruler.
2 Select the Pen tool ( ) in the Tools panel.
3 Using the Pen tool, click to place vertices around the actor until you have enclosed
her completely. Doubleclick the last vertex.
4 To make sure that your garbage mask isn’t too tight, drag the currenttime indicator
across the time ruler and make sure the actor does not move out of the masked area.
If she does, switch to the Selection tool ( ) and adjust the vertices.
5 Choose File > Save to save your work.
Lesson 9. Keying
Lesson 9. Keying Page 10
Applying the Color Difference Key effect
There are many keying effects in After Effects. The Color Difference Key effect creates
transparency from opposite starting points by dividing an image into two mattes, Matte
Partial A and Matte Partial B. Matte Partial B bases the transparency on the specified
key color, and Matte Partial A bases transparency on areas of the image that do not
contain a second, different color. By combining the two mattes into a third matte, called
the alpha matte, the Color Difference Key creates welldefined transparency values.
Confused yet? Most people who come across the Color Difference Key usually stop right
there and run away in terror. But you don’t need to fear the Color Difference Key.
1 Select the Talent_DV layer in the Timeline panel, and choose Effect > Keying > Color
Difference Key.
2 In the Effect Controls panel, click the eyedropper for the Key Color setting. Then,
click the green background color in the left thumbnail preview at the top of the panel.
3 Click the A button under the right thumbnail preview to view the Matte Partial A.
Portions of the background are still visible in the Matte Partial A preview. This is
actually a good thing, because it allows you to refine your key, which you’ll do now.
Lesson 9. Keying
Lesson 9. Keying Page 11
286 LESSON 9
Keying
4 Using the Black eyedropper (the middle one between the two thumbnail previews),
click the brightest portion of background that did not key out in the Matte Partial A
thumbnail preview. This will be near the top of the actor’s head.
5 Click the B button under the right thumbnail preview to see the Matte Partial B,
which is the inverse of Matte Partial A.
6 Using the Black eyedropper again, click the brightest portion of the remaining
background in the Matte Partial B thumbnail preview (near the bottom). This should
remove any remaining traces of the background.
7 Click the Alpha button under the right thumbnail preview. If this were a clean matte,
the actor would be completely white. She’s not, so you need to make some adjustments
to the effect.
Lesson 9. Keying
Lesson 9. Keying Page 12
8 In the Effect Controls panel, increase the Matte In Black amount to 50 and decrease
the Matte In White amount to 109. You can think of the Matte In Black and Matte In
White as being similar to the Levels effects.
Adjusting these two controls cleans up the alpha channel of the image. The result is a
clean key accomplished with just a few clicks of the mouse.
Checking the alpha channel for errors
The orange (or transparent) background of the composition makes it easy to see any
lingering bits of the green screen, but it may still be difficult to see any holes that may
have been created with the actor. To doublecheck your key, switch to the alphachannel
view to see the resulting matte.
Lesson 9. Keying
Lesson 9. Keying Page 13
288 LESSON 9
Keying
1 At the bottom of the Composition panel, click the Show Channel button ( ) and
choose Alpha from the popup menu.
You can now see the blackandwhite matte of your key. The black portion of the image
represents the area that is transparent. The white portion represents the area that is
opaque. Gray areas of the alpha channel (the feathered edge around the actor) are
semitransparent.
2 Make sure no portion of the actor is black or gray. If you have followed the steps so
far, you should be in good shape.
3 Click the Show Channel button again, and choose RGB to return to RGB view.
4 Hide the Color Difference Key properties in the Effect Controls panel.
5 Choose File > Save to save your work.
Choking the matte
Because the Color Difference Key only removes color from the clip, the edge of the actor
still has an unwanted fringe. To refine the edge of your matte, you need to choke, or
tighten, it.
1 Select the Talent_DV layer in the Timeline panel and choose Effect > Matte > Matte
Choker. This effect gives you more control over the edge of the matte than the Simple
Choker effect. The main difference between the two is that the Simple Choker only
allows you to tighten up the matte, while the Matte Choker also allows you to smooth,
or feather, the edges.
Lesson 9. Keying
Lesson 9. Keying Page 14
In the Effect Controls panel, the top three Matte Choker controls—Geometric
Softness 1, Choke 1, and Gray Level Softness 1—let you spread the matte as far as
possible without changing its shape. The next three controls can be used to choke the
matte.
In this lesson, most of the default settings work well. Consider yourself fortunate if this
is the case on all your future keying projects. The only setting that needs adjusting is the
Geometric Softness 2 setting, which you’ll use to create a slight blur along the edge of
the matte.
2 Increase the Geometric Softness 2 amount to 4.00.
3 Check the matte by clicking the Show Channel button at the bottom of the
Composition panel and choosing Alpha from the popup menu.
The matte looks great!
4 Switch back to the RGB view to get ready to remove some green spill.
5 Hide the Matte Choker properties to keep the Effect Controls panel tidy.
Lesson 9. Keying
Lesson 9. Keying Page 15
290 LESSON 9
Keying
Removing spill
If you look closely at the actor’s hair, you will see green highlights. This is the result of
green light bouncing off the background and onto the subject. You can remove this and
any unwanted green fringes around the actor with the Spill Suppressor effect. Typically,
the Spill Suppressor is used to remove key color spills from the edges of a matte. It is
essentially a simple desaturation filter.
1 Select the Talent_DV layer in the Timeline panel and choose Effect > Keying >
Spill Suppressor.
You may find it easier to select the spill color if you temporarily turn off the Color
Difference Key effect.
2 At the top of the Effect Controls panel, click the effect icon ( ) next to the Color
Difference Key effect to turn it off.
3 In the Spill Suppressor area at the bottom of the Effect Controls panel, select the
Color To Suppress eyedropper and click a green region near the actor’s hair.
4 Turn the Color Difference Key effect back on. The subject is now keyed out and the
unwanted green in and around her hair is gone.
5 Hide the Spill Suppressor properties.
Lesson 9. Keying
Lesson 9. Keying Page 16 Return to Table of Contents
Key out a background with the Keylight effect
There are many ways to pull a key in After Effects. In addition to using the Color Difference keyer,
another good alternative is to use the Keylight effect. Keylight is a plugin effect, licensed from
The Foundry, that comes with After Effects CS3 Professional. It is a powerful keyer with numerous
controls, and it is also one of the few effects that can pull a clean key in just one click.
If you’d like to try the Keylight effect, start this lesson over and complete the following exercise instead
of the “Applying the Color Difference Key effect,” “Choking the matte,” and “Removing spill” exercises.
1 With the Talent_DV layer selected in the Timeline panel, choose Effect > Keying> Keylight (1.2).
As with the Color Difference Key, the first step is to select the key color.
2 In the Effect Controls panel, select the Screen Colour eyedropper.
3 In the Composition panel, click a green area of the background near the actor’s shoulder.
Lesson 9. Keying
Lesson 9. Keying Page 17
292 LESSON 9
Keying
The results are instantaneous, and for many keying projects, one click will produce the desired result.
Still, you need to check for possible errors or holes. The effect’s View popup menu will help you find
and correct errors.
4 In the Effect Controls panel, choose Status from the View popup menu.
This shows an exaggerated view of the matte that is generated by the key color selection. Opaque areas
appear white, transparent regions appear black, and semitransparent pixels are gray. You can see that
large areas of the image are not keyed correctly.
5 In the Effect Controls panel, expand the Screen Matte property. Increase the Clip Black amount to
20.0, and decrease the Clip White amount to 90.0.
This tightens up the matte. There are still gray pixels in and around the subject, but that’s okay because
they blend with the background.
6 Choose Final Result from the View menu. The key is good, but there are artifacts around the edge.
7 Choose Colour Correction Edges from the View menu to see the edge of the matte.
Lesson 9. Keying
Lesson 9. Keying Page 18
8 In the Effect Controls panel, increase the Screen PreBlur amount to 5.0, and increase the Clip
Rollback amount to 0.5.
9 Choose Final Result from the View menu.
As is often the case in After Effects, you can achieve the same result using different methods.
Adjusting contrast
You can make the image stand out more by adjusting the levels.
1 Select the Talent_DV layer in the Timeline panel, and then choose Effect > Color
Correction > Levels.
Lesson 9. Keying
Lesson 9. Keying Page 19
294 LESSON 9
Keying
2 In the Levels area of the Effect Controls panel, increase the Input Black amount to
13.0.
3 Decrease the Input White amount to 225.0.
The Levels effect remaps the range of input color levels onto a new range of output color
levels and changes the gamma correction curve. The Levels effect is useful for basic
imagequality adjustment. It works the same way as the Levels adjustment in Photoshop.
Adding the background animation
With a clean key, you are now ready to add the background to the composition.
1 Press the Home key to make sure the currenttime indicator is at the beginning of the
time ruler.
2 Click the Project tab, and drag the L7BG.mov item from the Project panel to the
Timeline panel, placing it at the bottom of the layer stack.
Lesson 9. Keying
Lesson 9. Keying Page 20
See how the keyed actor looks against the animated background.
3 Press the 0 key on the numeric keypad to watch a RAM preview of the composition.
If you have a sharp eye, you may still notice a few aliasing artifacts here and there
around the actor. Remember, you are working with footage that originated in MiniDV,
so some aliasing is going to occur. Also, keep in mind that the computer monitor has a
better resolution than a television set. To accurately judge the results of your key, you
need to connect your system to a video monitor and view the results there.
4 When you are done watching the RAM preview, press the spacebar to stop playback.
5 Choose File > Save to save your work.
Adding the title
Now, you’ll add a text layer and create the title of the promo.
1 Press the Home key to go to the beginning of the time ruler.
2 Select the Horizontal Type tool ( ) in the Tools panel. After Effects opens the
Character and Paragraph panels.
3 In the Character panel, do the following:
• Choose a bold sans serif font, such as Impact or Helvetica Bold.
• Increase the Font Size to 60 pixels.
• Click the Fill Color swatch and choose a light yellow hue, such as RGB 255, 242, 158.
Lesson 9. Keying
Lesson 9. Keying Page 21
296 LESSON 9
Keying
4 Click in the Composition panel to the right of the actor and type Tuesdays with
Taryn, pressing Enter (Windows) or Return (Mac OS) after each word.
Stylizing the title
The text is okay, but a little boring. Spiff it up with a few adjustments.
1 In the Timeline panel, doubleclick the text layer name to select all of the text in the
Composition panel.
2 In the Character panel, do the following:
• Doubleclick the Stroke Color swatch. Set the color to black (RGB=0, 0, 0), and then
click OK.
• Change the Stroke Width to 6 pixels, and then choose Fill Over Stroke from the
Stroke Option popup menu.
• Change the Leading amount to 50 pixels.
• Change the Tracking amount to 25 pixels.
Lesson 9. Keying
Lesson 9. Keying Page 22
It’s getting better, but you’re not done yet. The word with is not an important word in the
title, so make it smaller to deemphasize it.
3 Highlight the word with in the Composition panel and change the Font Size to 48
pixels, the Leading amount to 48 pixels, and the Tracking amount to 50.
4 Doubleclick the text layer name in the Timeline panel to select all of the words
again, and then click the Faux Italic button ( ) near the bottom of the Character panel.
Note: You may need to extend the Character panel to see the Faux Italic button.
Lesson 9. Keying
Lesson 9. Keying Page 23
298 LESSON 9
Keying
5 In the Paragraph panel, click the Center Text button ( ).
There’s a good chance that centering the text caused it to jump on the screen, so adjust
its position.
6 Using the Selection tool ( ), drag to reposition the text layer in the Composition
panel so that it is in the upperright corner of the image.
Lesson 9. Keying
Lesson 9. Keying Page 24
Checking placement
When positioning text, you should always make sure it falls within the titlesafe area
of the screen. This is the area that will be visible to viewers watching the final movie at
home on TV. To check your title’s position, turn on the titlesafe guide.
1 Click the Choose Grid And Guide Options button ( ) at the bottom of the
Composition panel and choose Title/Action Safe from the popup menu.
2 Use the Selection tool to reposition the title within the titlesafe zone.
You can leave the guides visible for the remainder of this lesson, or turn them off,
whichever you prefer.
Lesson 9. Keying
Lesson 9. Keying Page 25
300 LESSON 9
Keying
Adding a drop shadow
The text looks pretty good, but you can make it even better by adding a drop shadow.
1 With the Tuesdays with Taryn text layer selected in the Timeline panel, choose
Effect > Perspective > Drop Shadow.
Note: Alternatively, you could apply a drop shadow using the drop shadow layer style in
After Effects CS3.
2 In the Effect Controls panel, increase Opacity to 100%.
3 Reduce the Distance amount (the distance of the shadow from the text) to 0.0, and
increase the Softness amount to 80.0.
Now, the title looks more dramatic.
4 Choose File > Save to save your work.
Adding the animated logo
In Lesson 2, you created a logo for the fictional Channel 5 newscast. Next, you’ll import
that project into this one and add it to the composition.
1 Bring the Project panel forward and doubleclick an empty area in it to open the
Import File dialog box.
2 Navigate to the AECS3_CIB/Lessons/Lesson09/Assets folder. Select the
Channel5_logo.aep file, and then click Open.
This project file is the same as the one you created in Lesson 2, except that it doesn’t
include the Golden Gate Bridge image and it has been resized to match the aspect ratio
of this project.
Lesson 9. Keying
Lesson 9. Keying Page 26
When you import a project, After Effects creates a folder for it in the Project panel that
contains the composition and its associated media files.
3 Expand the Channel5_logo.aep folder in the Project panel to see its contents.
4 Press the Home key to make sure the currenttime indicator is at the beginning of
the time ruler.
5 Drag the Logo/Channel 5 news composition from the Project panel to the Timeline
panel, and place it at the top of the layer stack.
Lesson 9. Keying
Lesson 9. Keying Page 27
302 LESSON 9
Keying
Copying effects across two layers
The Channel 5 news logo could use some pizzazz similar to the improvements you made
to the title Tuesdays with Taryn. The easiest way to make the same changes is to copy
and paste them onto the logo.
1 Select the Tuesdays with Taryn text layer in the Timeline panel, and press E to display
all of the effects properties for the layer.
2 Select the Drop Shadow property name for the Tuesdays with Taryn layer, and then
choose Edit > Copy or press Ctrl+C (Windows) or Command+C (Mac OS).
3 Select the Logo/Channel 5 news layer in the Timeline panel, and then choose Edit >
Paste or press Ctrl+V (Windows) or Command+V (Mac OS).
After Effects copies the drop shadow effect to the Channel 5 news logo, with the same
settings you applied to the title text layer. Select the Logo/Channel 5 news layer and
press E to see the drop shadow property.
4 Save your project, and then press the 0 key on the numeric keypad to create
and watch a RAM preview of the final spot. You might want to drag the work area
end bracket to about 4:20 to preview only the first half, which is where most of the
animation occurs.
5 Press the spacebar when you want to stop playback.
Lesson 9. Keying