Tutorial 3.3: Keylight, Masking, and Color Correcting |
This tutorial tells you how to best take advantage of the Keylight plugin by doing two different composites. I guess that's kinda obvious from the title. However, it also shows you a few tricks on masking and color correcting that can be applied to other nodes as well.
You can find the sample images in doc/pix/keylight. As of v2.2, the images are packed separately from the docs, so if they aren't present, you may have to download them from our website (as always, www.nothingreal.com). If they are in the software directory, you can easily access them by using the Favorites pulldown in the Browser and going to the <installation_directory>/doc/pix/ directory.
Find the images in pix/keylight, reading in merlin_fg and merlin_bg with a FileIn. Remember both images can be read in simultaneously by dragging the mouse over both listings and hitting OK in the browser.
merlin_fg.jpg
|
merlin_bg.jpg
|
![]() |
![]() |
Select the foreground image and connect the Keylight node from the Key tab. Attach the background image as the second input.
|
![]() |
Looking at the Keylight parameters, you will see several Color Pickers. Click down on the screenColour picker and drag across the green screen color in the Viewer. This of course describes the color of the blue or green screen. Keylight doesn't work well at all with secondary colors (cyan, magenta, yellow), by the way. You should get a fairly decent key with your initial pick.
|
![]() |
You can notice the new Color Picker buttons at the top - one of them is a radio button indicating that you are scrubbing across the Source Buffer, meaning the unmodified foreground image. This allows yo u to re-scrub the green screen without having to worry about the background color. You can also decide to measure the current pixel values, or the minimum or maximum pixel values. However, for this exercise, you can leave the buttons in their default state.
|
|
If you look at the alpha channel of the comp, you will notice several transparent areas in the woman. Unlike Primatte, which allows you to do several picks to allocate foreground and background material, Keylight relies on sliders to tune the relationship between foreground and background. In this example, there are two sliders that can help us. The first one is the screenRange slider. By moving this up, you decrease the range between completely transparent and completely opaque. For this comp, you can move it to about .03 and you will remove most of the dropout. However, you will notice the hair has lost some of its softness. Return the slider to 0, and open up fineControl, and then the balance subtree. These sliders are, ahem, difficult to describe. You can notice that the green screen is minutely weighted with more blue than red. By bringing the balance closer to zero (.5 means no effect), you tell Keylight to take into account the difference between the green and red (since red is the weakest color in the screen) and ignore the difference between the green and the blue. This makes sense, since if you have a screen value of .2, .85, .25, you get a little bit more range with green-red (.65) than green-blue (.6). Since math is hard, let's go shopping.
|
![]() |
Anyway, in this example, take the midtoneBalance and drop it to around .3, and most of the noise should drop out, retaining the softness of the edge. |
![]() |
There is still probably a bit of noise in the background area. To
fix this, you can draw a garbage matte with QuickShape. Create
a Image - QuickShape, and then look at the comp.
To see the controls of the QuickShape, hit the Display
Controls button in the Viewer, pressing it down:
|
![]() |
Once you have drawn the shape, hit the Build button in the Viewer, and then plug the node output into the fourth input (garbageMatte) of the Keylight node to remove the gunk on the side of the image. Oops - the matte is backwards, so apply a Color - Invert onto the QuickShape to turn it around. Wherever the mask is white will be removed. However, when you look at the new alpha mask, you will probably see a rather suspicious line at the edge of the mask.
|
![]() ![]() |
To correct this, insert a Blur after the Invert and soften the edge. But when you do this, you will more than likely get clipping on the top the head. This is because the QuickShape 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 calling us up and screaming at us because we lied about that whole Infinite Workspace thingy. Actually, nope, its just that Blur is the only function where you have the option to work with the Infinite Workspace on or off. To remove the clipping, simply toggle the Blur's spread parameter to Outside Frame. You could of course also have adjusted the QuickShape's height parameter to 540, but that would be rather tedious, wouldn't it? | ![]() ![]() ![]() |
Venturing away from keying for a moment, here is how you would color-correct the foreground. Let us assume that we need the woman to take on a red hue due to the red room she is in. We obviously don't want to apply a color-correct after the Keylight comp, because that would change the already Amazingly Perfect Background. We also can't put it before the Keylight comp, because that would change the Amazingly Perfect Green Screen. We would seem to be in a pickle (If you don't speak English as your first language, feel free to drop me a line for technical descriptions of any of the completely obsolete slang I use in these tutorials.). Fortunately, the kids at CFC have taken this problem into account in two ways.
The first way is that Keylight has color correction tools built into the keyer, for exposure (Shake's Mult node), gamma and saturation. Feel free to use these if they are sufficient for your correction. One advantage with the built-in tools is that they are calculated into the keying lookup table, so you will have a slight speed advantage over using extra nodes. However, to do other operations like transformations or color-correction curves, you will need to do something else.
![]() |
![]() |
![]() |
If things look good, delete the Gamma node and continue with your no doubt happy life.
Just as a completely non-related aside, how many people accidentally type merling when trying to type merlin? It's eerie.
The Saint images used courtesy of CFC and Paramount British Pictures Ltd.
The second composite is from The Saint, which CFC worked on (ahem, not using Shake...Cineon, I believe). I've included five images of foreground and background footage at video resolution in the pix/keylight directory, exotically named saint_fg.1-5#.jpg and saint_bg.1-5#.jpg. I'm going to warn you in advance: never use jpgs for any footage you have to key. The compression will seriously screw you up, as you will find in this tutorial.
The first thing you will 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. We won't sweat that for the moment, but will instead focus on the aspect ratio. In the Globals tab, open up the proxyScale subtree and change the proper ratio into the proxyRatio parameter. Enter either .5 or 1/2 - Shake will resolve it to .5 anyway.
This squeezing can be turned on and off very quickly
with the proxy on
|
![]() |
||
Now attach the Keylight operator, with the background going into the first input and the foreground going into the second. Select the screenColour picker and scrub on the back window of the car. We scrub here because it doesn't have all of the reflections that we see in the side window. Now, one thing that may be stressing you out is that we are working on logarithmic (i.e., filmic, rather than linear digital or video) color space images. Don't fret - at the bottom of Keylight, you can indicate in which color space it should work in. Toggle over to log for this composite.
|
|
Before you get too excited about this, you will notice there is some blue spill on her hair on the right side (her left side). It's real subtle. To see it better, you might want to pull down the original 2k plates. No, wait. That's not right. You might want to append a DelogC to see it in linear space - this will return it to something resembling the real world. Make sure you don't do your pixel scrubs through the Delog. You must return the Keylight node to the Viewer before scrubbing. Anyway, to get rid of the bluespill, click on the fgBias color picker, and drag along her hair (the blond part, not the bluespill part). This should suck out the blue. Keep in mind you will probably see ringing because of the jpeg compression on the foreground element. Nothing you can do about that for this tutorial. Sorry.
|
![]() |
||
If the rest of the image turns yellow, which, let's face it, it will, hold down the S key and put the cursor over the color picker for fgBias and drag left - this will decrease the saturation of the color. The second way to help reduce the yellow is to move the balance parameters up to 1. It won't reduce all of it - her scarf and map will still have some yellow in them, but it will help. We'll fix this some more after the next step. |
![]() |
If you turn on the alpha channel in the Viewer (hit A with the cursor over the Viewer), you will be appalled at what fgBias has done to your matte. Looking at the comp again, (hitting C over the Viewer) you can see the snow on the road behind the seatbelt. This sucks.
|
|||||||||
The solution is to use the third image input, the HoldOutMatte. This will require you to pull a very rough second key. For the sake of clarity, rename the Keylight node as MainKey by changing the nodeName in the parameters. Then copy the node (select, hit Ctrl+C) and paste it in (Ctrl+V). Open its parameters, and rename it HoldKey. Attach it to the foreground. Make sure the foreground goes into the second input of HoldKey. Then plug that into the third input of MainKey. Now, to make the mask of HoldKey absolute, boost its screenRange up to .3. This makes your mask black and white with no gray. When it 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.
|
![]() |
||||||||
Looking closely at the mask of MainKey, you will see that the holdout matte has pretty much destroyed the edge quality. To fix this, you should eat into the edge of the holdout matte. Do this by inserting a Filter - DilateErode and a Filter-Blur between the two Keylight nodes. Enter a value of perhaps -3 pixels on DilateErode, and a Blur value of 6 pixels. From the illustrations, you can see that we have reduced and softened the holdout matte, which has its effect on the MainKey matte.
Now, to quickly compare the effect of the holdout matte and the comp without it, open up the plumbing subtree, and toggle the useHoldOutMatte button on and off.
|
![]() |
Now that we have a holdout matte, we can help get rid of the yellowish color by using the replaceColour. This is for areas that have been accidently keyed out because they were lit with more blue light rather than white light. The replaceColour can help you correct that lighting. You must construct a holdout matte for these areas. In this case, I chose a color opposite of the warm yellow, a mid-saturation purple. In the illustration, the uncorrected yellowish image is on the left. The image with the replace color is on the right. We are using it here to help correct the yellow hue that occurred from the spill suppression. The effect is subtle because the pixels were not very close to the screenColour. To end this tutorial, it should be noted that, like all keyers, Keylight is not a magic bullet, although there will frequently be cases where it works with one pixel scrub. Feel free to use Keylight in conjunction with other mask techniques and keyers, mixing them together through the use of the KeyMix function, or through the adding/subtracting of mattes with tools like IMult, IAdd, ISub, Max, LayerMacro, etc. |
![]() |