Tutorial 3.3: Keylight, Masking, and Color Correcting |
This tutorial discusses how to best take advantage of the Keylight plugin and shows you a few masking and color correcting tricks that can be applied to other nodes as well.
The composite used in the first section is from "Merlin," and demonstrates the basic steps to using Keylight (effects by CFC).
Add an Image - FileIn node and browse to doc/pix/keylight.
Note: To read in both files simultaneously, drag-select the
files and click OK in the Load image or sequence browser.
merlin_fg.jpg
|
merlin_bg.jpg
|
![]() |
![]() |
In the Node View, select merlin_fg and add a Key - Keylight node.
Connect the merlin_bg node to the second input (the background
input) on the Keylight node.
Keylight has several Color Pickers. In this lesson, the important color picker is screenColour. (Guess in what country CFC is based.)
How good is your mask?
The quality of your mask cannot always be gauged visually. Depending on your monitor gamma, the results of this tutorial differ. The default settings differ from system to system, or, if you are in a large film facility, you may be using custom lookups (check out Cinespace from Rising Sun) to hammer the display to look like film output. (If it appears this issue is being brushed quickly by, you're right. It's far too complicated to treat in a tutorial.) Shake allows you to apply a custom gamma lookup on the Viewer to examine your images.
Right-click g/o/log and select Load Viewer Lookup Controls into Parameter 2 Tab.
In the Parameters2 tab, boost the viewerGamma value to approximately
2.
viewerGamma
= 1
|
viewerGamma
= 2
|
![]() |
![]() |
The heightened gamma reveals noise in the image. If you lower the viewerGamma holes are revealed in the mask. You probably don't see much until you drop below .5, so don't worry about the holes for this composite. However, try to correct the background noise. Keep in mind this image is going to be projected on a very large screen in front of millions of science fiction geeks who later take your film and advance frame-by-frame on their DVD player to reveal the multitude of errors. Perfectionism pays. You have been warned.
Unlike Primatte, which allows you to do several picks to allocate foreground and background color, Keylight relies on sliders and masking to tune the relationship between foreground and background. In this example, there are two parameters to help you. (The possibility exists your mask is fine, by the way.)
The first parameter to adjust the mask is screenRange. Raising this value increases the contrast in the mask. This slider is typically used for garbage masks that are later fed into other masks, as it tends to remove fine detail. Test the effect of adjusting the screenRange values:
In the Viewer, click g/o/log to deactivate the VLUT.
Ensure the Keylight node is selected in the Node View.
The mask is filled, but the edge quality disappears.
The mask is filled in, but some of the hair detail drops off.
Return the screenRange value to 0.
See the Keying Overview for screenRange strategies.
The second set of mask opacity controls are the Gain parameters found in the fineControl subtree. Raise or lower the Gain parameters to increase or decrease the mask in the low, midtone, or highlight areas.
In the Viewer, click the VLUT button to activate the VLUT.
Right-click g/o/log and select Load Viewer Lookup Controls into Parameter 2 Tab.
In the Parameters2 tab, ensure your viewerGamma is set to 2 (or above).
In the Parameters1 tab, open the fineControl subtree.
The noise disappears. However, is this a good thing?
The Viewer reveals that hair detail has been removed. This is bad.
To restore the hair detail, set highlightGain back to 0.
highlightGain
= .4
|
highlightGain
= 0
|
![]() |
![]() |
Note: To toggle the Viewer between alpha and color, position the cursor in the Viewer and press C or A.
So right about now, you may be thinking these parameters are useless and to never touch them and maybe there's something on TV worth watching at the moment that is for more interesting than dreary tutorials. These parameters are often useful, but this example reveals problems you must consider when keyingnoise and edge detail. In this case, another approach should be taken, which is the use of masks.
Draw a garbage matte to get rid of the noise (as well as the line on the left side of the image).
With nothing selected in the Node View, add an Image - RotoShape.
The roto tools appear in the Viewer.
Draw a loose rotoshape around the figure. The build shape tool is enabled by default.
In the Viewer, click the build button to close the shape.
Connect the RotoShape node to the fourth input (garbageMatte) of the Keylight1 node to remove the gunk on the side of the image.
Doh! The matte is reversed and must be inverted.
In the Node View, select the RotoShape1 node.
Apply a Color - Invert to RotoShape1.
The mask is reversed.
Click VLUT to activate the VLUT. You don't have to modify the values;
they are saved for the session.
As soon as the blur is activated, the top of the head gets clipped off. What's up with that? The RotoShape is a puny and weak 486 pixels high by default and the other images are a mighty 540 pixels. So, right about now, you are screaming at us because we lied about that whole Infinite Workspace thingy. Before you jump to the phone, be aware that Blur is the only function that gives you the option to work with the Infinite Workspace on or off. By default, it is deactivated so you can blur full-frame images without a black edge on the border.
To activate the Infinite Workspace and remove the clipping, toggle the Blur spread parameter to Outside Frame (from In Frame Only).
spread
= In Frame Only
|
spread
= Outside Frame
|
![]() |
![]() |
To venture away from keying for a moment, this section discusses color correcting the foreground. Since the woman is composited into a red room, cast the woman with a red hue. You don't want to color correct after the Keylight composite, because that would change the already Amazingly Perfect Background. You also can't color correct before the Keylight node, because that would change the Amazingly Perfect Green Screen. You seem to be in a pickle (If you don't speak English as your first language, feel free to drop a line for technical descriptions of any of the completely obsolete slang used in these tutorials.). Fortunately, the kids at CFC have taken this problem into account in two ways.
First, Keylight has color correction tools built into the keyer, for exposure (the Shake Mult node), gamma and saturation. Feel free to use these tools if they are sufficient for your color correction. An advantage of the built-in tools is that they are calculated into the keying lookup table, so you have a slight speed advantage over using extra nodes. However, to do other operations like transformations or color-correction curves, you need to do something different.
It is very rare that you read in your elements, key, and composite
with only one node. To apply other effects to the foreground, you must break
the compositing out of the keying operations and use Over nodes instead.
In the Keylight parameters, notice several unimaginative buttons for
the output.
The fourth button from the left is called unpremult an unpremultiplied image. The key is knocked out of the foreground, but is then again divided by its mask. You can then apply color corrections before compositing over the background. This setting is to prepare your foreground for color corrections. If you are only applying filters or transforms, set it to on Black.
With the output switched to unpremult, the composite looks terrible. This unpremultiplied state is temporary until you composite with an Over command.
This still leaves you with a horrid looking image that you definitely would not invite over to tea, but at least the background isn't in the comp, so you are good so far.
In the Node View, select the Keylight1 node.
Attach a Color - Compress node. This is used for the color correction.
Attach a Layer - Over node to the Compress1 node.
Connect the merlin_bg image to the second input of Over1.
Here is the crucial trick:
The nasty gunk around her is removed.
For the color correction:
For High Color, scrub on a bright part of the background.
![]() |
![]() |
Note: In the Color Picker tab, note that Use Source Buffer is off. This is good, since you want to scrub color from the comp rather than from the unpremultiplied image coming out of Keylight.
This is, of course, an extreme color-correction used for illustration purposes.
The principal concept here is that you spit out an unpremultiplied image, do your color corrections or transformations, and then composite with preMultiply enabled. You can alternatively use On Black for your output from Keylight, apply a Color - MDiv, do your color corrections, and then apply a Color - MMult to get the same result, but this complicates the tree.
This is a handy trick learned between random beatings on the playground... Use the VLUT to gauge the color correction. If it is a good correction, the foreground blacks should be somewhat similar to the background blacks when the gamma is boosted, and the brights should be similar when the gamma is brought down below 1.
A
bad correction
|
Highlights
are good
|
Lows
are good
|
![]() |
![]() |
![]() |
If things look good, deactivate the VLUT and continue with your happy life.
The Saint images used courtesy of CFC and Paramount British Pictures Ltd.
The composite used in the following section was created by CFC for the film The Saint (ahem, not using Shake. Cineon, it is believed). For this lesson, use the five foreground and background images (at video resolution) in the pix/keylight directory.
|
The first thing you notice is that these are anamorphic frames, so everything is squeezed. Additionally, the element is originally a scanned Cineon plate, so it is in logarithmic color space. Don't sweat that for the moment, but instead focus on the aspect ratio.
This squeezes the images by half in Y:
proxyRatio
= 1
|
proxyRatio
= .5
|
![]() |
![]() |
This squeezing can be turned on and off very quickly with the
proxy button at
the top of the interface. "Other" indicates you are using a custom
proxy setting rather than a preset (P1, P2, P3). The scaling is just temporary
while you work with the script. When finished with the composite, reset the
proxyRatio to 1. For more information, check the About
Aspect Ratio page in the Overview.
Now, one thing that may be stressing you out is that you are working on logarithmic (that is, filmic, rather than linear digital or video) color space images. Don't fretat the bottom of Keylight, you can indicate in what color space Keylight is working.
Note: All masking data is dependent on your monitor gamma. Use the VLUT to ensure you have an accurate key as you proceed with the tutorial.
Before you get too excited about this, there is some blue spill
on her hair on the right side (her left side).
It's real subtle. To see it better, you may want to pull down the original 2K plates. No, wait. That's not right. You can linearize the log plates to return it to something resembling the real world:
Set
on the Viewer to
.
Right-click the VLUT button (g/o/log) and select Load Viewer Lookup Controls into Parameter 2 Tab.
In the Paramters2 tab, set viewerLogLin to LogToLin.
To help get rid of the blue spill:
Scrub
for blue spill on the hair
|
With
spill suppression
|
![]() |
![]() |
The blue is removed. (A ringing effect may occur due to the JPEG compression on the foreground element. Nothing you can do about that for this tutorial. Sorry.)
To minimize any yellowness that may occur in the image, you can decrease the fgBias saturation. The stronger the saturation of the fgBias color, the stronger the yellow tint.
You can also set the balance parameters to 1 to reduce the yellow tint. It does not reduce all of the yellowher scarf and map may still retain some yellowbut it helps.
The yellow color correction is further adjusted in the "The Saint: Using the replaceColour" section.
Show the alpha channel in the Viewer (press A with the
cursor in the Viewer), and you are no doubt appalled at what fgBias
has done to the matte. Return to the composite view, (press C over
the Viewer) and notice the snow on the road is visible behind the seatbelt.
This blows.
![]() |
![]() |
To correct this, pull a simple rough second key and connect the key to the Keylight node's HoldOutMatte (third image input).
Copy the Keylight node (select the node, press Command+C / Ctrl+C to copy and Command+V / Ctrl+V to paste).
In the new Keylight node parameters, rename the node HoldKey.
Connect saint_fg to the first input of the HoldKey node.
Connect HoldKey to the third input of the Keylight1 node.
When the hold out matte is plugged in, it acts as a mask for the foreground. You are, of course, not obliged to use Keylight. Feel free to use roto, Primatte, Chroma/LumaKeys, etc., as well. The following illustrations show the HoldKey alpha and the Keylight1 alpha. HoldKey contains no grey tones, Keylight1 retains the window reflections.
HoldKey
|
Keylight1
|
![]() |
![]() |
The holdout matte has destroyed the edge quality of Keylight1. To correct the edge quality, chew into the edge of the holdout matte.
In the DilateErode1 parameters, set x/yPixels to approximately -3 to chew into the matte.
In the Blur1 parameters, set x/yPixels to approximately
6 to soften the matte.
Blur1
|
Keylight1
|
![]() |
![]() |
The hold matte strengthens the normal key pulled by Keylight.
Test the effect of the holdout matte:
Without
holdout matte
|
With
holdout matte
|
![]() |
![]() |
You can use the holdout matte with the Keylight replaceColour parameter to help get rid of the yellowish tint. This is for areas that are keyed out by mistake because they are lit with more blue light than white light, and are also included in the holdout matte area. The replaceColour can help to correct that lighting.
In the Viewer, show the composite (press C with the cursor in the Viewer)
In the Keylight1 parameters, click the replaceColour Color Picker.
Select a color opposite of the warm yellow, which is a mid-saturation purple.
In the following split illustration, the uncorrected yellowish image is
on the left. The image with the replace color is on the right.
As an end note, like all keyers, Keylight is not a magic bulleta key rarely works with a single pixel scrub. Feel free to use Keylight in conjunction with other mask techniques and keyers, and combine the keys through the use of the KeyMix function, or through the adding/subtracting of mattes with tools like IMult, IAdd, ISub, Max, LayerMacro, etc.