Keylight
Keylight is an industry-proven color difference keyer. Use the Screen Color selector to choose a color from the Source input to use as the blue/green screen color and the View dropdown menu to judge the key. To remove blue/green spill from the foreground object, use the Despill Bias control to pick skin tones from the source. Use the Screen Matte parameters to improve the matte.
Keylight’s core algorithm was developed by the Computer Film Company (now Framestore) and has been further developed by Foundry.
Copyright © 2024 Foundry & Framestore. All rights reserved.
Inputs and Controls
Connection Type |
Connection Name |
Function |
Input |
bg |
The background image to replace the blue/green screen in the foreground. |
OutM |
The Outside Mask, or garbage matte, used to remove unwanted objects (lighting rigs, and so on) from the foreground. |
|
InM |
The Inside Mask, or holdout matte, used to confirm areas that are definitely foreground. |
|
Source |
The foreground image to key. |
Control (UI) |
Knob (Scripting) |
Default Value |
Function |
Keylight Tab |
|||
View |
show |
Final Result |
Select what you want to render into the output. • Source - view the blue/green screen foreground image. • Source Alpha - view the foreground image’s alpha channel. • Screen Matte - view the matte created from picking the Screen Color. It does not include any inside or outside masks. • Inside Mask - view the inside input. This is used to firm up the foreground matte to stop print through. • Outside Mask - view the outside input. The outside mask is used as a garbage mask to reveal the background. • Combined Matte - view the screen matte, inside mask, and outside masks added together. • Status - view an exaggerated view of the key so that minor problems are shown clearly. • Intermediate Result - view the intermediate result. Use this option on shots that can only be keyed using several different keys on different parts of the image (multipass keying). This renders the original source image with the Screen Matte generated in this Keylight node. In Keylight nodes down the tree, you should set the Source Alpha in the Inside Mask folder to Add To Inside Mask. • Final Result - this creates a premultiplied RGBA foreground that can be composited later. There’s an Unpremultiply Result checkbox you can use if you wish. • Composite - this renders the foreground composited over the background using all mattes, spill and color corrections. |
Unpremultiply Result |
unPreMultiply |
enabled |
When disabled, the key result is not unpremultiplied. If you’re using premultiplied images, you should leave this enabled. |
Screen Color |
screenColor |
0, 0, 0 |
Sets the screen color to become transparent, usually blue or green background. |
Screen Gain |
screenGain |
1 |
Adjusts how much of the screen color is removed to make the screen matte. Increasing this value keys more. |
Screen Balance |
screenBalance |
0.5 |
Sets the balance point for the image to key. Generally speaking, blue screens tend to work best with a balance of around 0.95 and green screens with a balance of around 0.5. If the key is not working too well with these settings, try setting the balance to about 0.05, 0.5 and 0.95 and see what works best. |
Alpha Bias |
alphaBias |
0.5, 0.5, 0.5 |
Adjusts the AlphaBias in case your screen color isn’t purely blue or green and is causing parts of the foreground image to become transparent. Pick the color from the part of the foreground that is affected. |
Despill Bias |
despillBias |
0.5, 0.5, 0.5 |
Adjusts the DespillBias to remove any remaining spill from around the foreground image. The most useful colors to pick for Despill Bias are often hair colors and skin tones. Note: This control is disabled unless Use Alpha Bias for Despill is disabled. |
Use Alpha Bias for Despill |
gangBiases |
enabled |
When enabled, use the AlphaBias color as the DespillBias color. When disabled, set the DespillBias color separately. |
Screen PreBlur |
preBlur |
0 |
Adjusts how much you want to soften the foreground image used to generate the key. If you’re keying digital video or grainy footage, you might get better results if you adjust this control slightly. |
Screen Matte |
|||
Clip Black |
screenClipMin |
0 |
Sets the cut off point below which alpha values in the Screen Matte are set to zero. Note: Adjusting this control too aggressively can cause hard edges between the foreground and background. |
Clip White |
screenClipMax |
1 |
Sets the cut off point above which alpha values in the Screen Matte are set to the white point. Note: Adjusting this control too aggressively can cause hard edges between the foreground and background. |
Clip Rollback |
screenClipRollback |
0 |
Allows edge detail to be restored after clipping the Screen Matte too aggressively using the ClipBlack and ClipWhite controls. |
Screen Dilate |
screenGrowShrink |
0 |
Adjusts alpha values in the Screen Matte. Either grow (if greater than zero) or shrink (if less than zero) the alpha in the Screen Matte at a sub-pixel level. Note: This control should not normally be used as eroding edges can produce a very poor key. |
Screen Softness |
screenSoftness |
0 |
Controls the amount of blur applied to the matte. For example, softness could be used on a very harsh matte pulled for use as an inside matte further down the tree. |
Screen Despot Black |
screenDespotBlack |
0 |
Removes isolated spots of black in a white matte by simplifying the matte. Black specks in the white matte are absorbed by the surrounding white areas. |
Screen Despot White |
screenDespotWhite |
0 |
Removes isolated spots of white in a black matte by simplifying the matte. White specks in the black matte are absorbed by the surrounding black areas. |
Screen Replace |
screenReplaceMethod |
Soft Color |
Sets the color method to use for pixels where the alpha of the Screen Matte has been modified: • None - the despilled image is left untouched if the alpha is modified. • Source - the image will have a corresponding amount of the original pixel (screen color and all) reintroduced/removed if the alpha is changed. • Hard Color - the despilled image has a corresponding amount of the Screen Replace Color added for any increase in alpha. • Soft Color - the despilled image has a corresponding amount of the Screen Replace Color added for any increase in alpha, however, it attempts to modulate the luminance of the resulting pixel so that it matches the original pixel. This produces a more subtle result than the Hard Color option. |
Screen Replace Color |
screenReplaceColour |
0.5, 0.5, 0.5 |
Sets the color to add where the alpha of the Screen Matte has been increased by the mask when Inside Mask > Inside Replace is set to HardColor or SoftColor. |
Tuning |
|||
Midtones At |
midPoint |
0.5 |
Sets the base midtone level used by the Gain controls below. |
Shadow Gain |
lowGain |
1 |
Adjusts the strength of the shadows in the Screen Matte. |
Midtones Gain |
midGain |
1 |
Adjusts the strength of the midtones in the Screen Matte. |
Highlights Gain |
highGain |
1 |
Adjusts the strength of the highlights in the Screen Matte. |
Inside Mask |
|||
Source Alpha |
sourceAlphaHandling |
Ignore |
This parameter determines what to do with any embedded alpha in the original source image. You will need this if you are doing multiple keys on different parts of the image with the View output set to Intermediate Result: • Ignore - this does not add any embedded alpha to the screen matte. • Add To Inside Mask - the embedded alpha is added to the inside mask. You should select this when multipass keying with View set to Intermediate Result. • Normal - the embedded alpha is used to composite the image. |
Inside Replace |
insideReplaceMethod |
Soft Color |
Sets the color method to use for pixels where the alpha of the Inside Matte has been modified: • None - the despilled image is left untouched if the alpha is modified. • Source - the image will have a corresponding amount of the original pixel (screen color and all) reintroduced/removed if the alpha is changed. • Hard Color - the despilled image has a corresponding amount of the Screen Replace Color added for any increase in alpha. • Soft Color - the despilled image has a corresponding amount of the Screen Replace Color added for any increase in alpha, however, it attempts to modulate the luminance of the resulting pixel so that it matches the original pixel. This produces a more subtle result than the Hard Color option. |
Inside Replace Color |
insideReplaceColour |
0.5, 0.5, 0.5 |
Sets the color to add where the alpha of the Inside Matte has been increased by the mask when Inside Mask > Inside Replace is set to HardColor or SoftColor. |
Crops |
|||
X Method |
SourceXMethod |
Color |
When the crop controls are in use, sets the fill method to use on the X axis at the edges of the clip: • Color - uses the Edge Color to fill the cropped area. • Repeat - the edge pixels are used to fill the cropped area. • Reflect - an equal number of pixels are reflected back from the image to fill the cropped area. • Wrap - an equal number of pixels are wrapped from the opposite edge to fill the cropped area. |
Y Method |
SourceYMethod |
Color |
When the crop controls are in use, sets the fill method to use on the Y axis at the edges of the clip: • Color - uses the Edge Color to fill the cropped area. • Repeat - the edge pixels are used to fill the cropped area. • Reflect - an equal number of pixels are reflected back from the image to fill the cropped area. • Wrap - an equal number of pixels are wrapped from the opposite edge to fill the cropped area. |
Edge Color |
SourceEdgeColour |
0 |
When an XY Method is set to Color, sets the color used to fill the cropped area. |
Left |
SourceCropL |
0 |
Sets the crop amount from the left edge. |
Right |
SourceCropR |
1 |
Sets the crop amount from the right edge. |
Bottom |
SourceCropB |
0 |
Sets the crop amount from the bottom edge. |
Top |
SourceCropT |
1 |
Sets the crop amount from the top edge. |
Keylight |
|||
InM Component |
insideComponent |
None |
Sets the component to use from any Inside Mask attached to the InM input: • Luminance - the luminance of the image connected to the InM input is used. • Inverted Luminance - the luminance of the image connected to the InM input is inverted before use as the mask. • Alpha - the alpha of the image connected to the InM input is used. • Inverted Alpha - the alpha of the image connected to the InM input is inverted before use as the mask. |
OutM Component |
outsideComponent |
None |
Sets the component to use from any Outside Mask attached to the InM input: • Luminance - the luminance of the image connected to the OutM input is used. • InvertedLuminance - the luminance of the image connected to the OutM input is inverted before use as the mask. • Alpha - the alpha of the image connected to the OutM input is used. • InvertedAlpha - the alpha of the image connected to the OutM input is inverted before use as the mask. |
About |
about |
N/A |
Click to display a Keylight informational box. |
Step-by-Step Guides
Video Tutorials
One important task of compositing is the removal of bluescreen or greenscreen. Nuke provides a wide variety of keyers for this task. I am going to go through several of these very briefly just so you have an introduction. I have brought in two pieces of footage to try this on. There is a greenscreen of the man that we used previously and there is also a still image of a house. It just has a bright sky and, even though there is no green or blue in this particular photo, you can still use keyer tools to attack the sky and remove it. You can reach the keyer tools through the Keyer menu.
I am going to start with the simplest one, which is called Keyer. Now, even though it doesn’t have a lot of options, it is great for certain circumstances like this. I am going to drop down the A pipe between the Merge and the Read node. The Keyer has several operations, one of which is luminance key, which is default. You can also target certain colors like green, or certain properties like saturation. We will leave it at luminance for now. There is also a graph here, which represents the operation values. For example, this graph represents luminance, as it runs from 0 towards 1, or the maximum. There are also four yellow bars here: A, B, C, and D. You can click-and-drag those interactively. Now B and C are overlapping at the start, but you can separate them. As soon as I move these, the alpha matte will start to be formed. Let’s go take a look at that. I am going to go into the Viewer and press the A key; there’s the alpha channel. What this signifies is any pixel with a luminance value between B and C becomes opaque. Any pixel value that had a luminance between C and D, or B and A, has a tapering value somewhere between opaque and transparent. So, in this situation, what I can do is move B and A towards the far-left, and then adjust C and D to make the sky mostly transparent. For example, what this means is any pixel with a luminance value over 0.9 becomes 100% transparent, or if a pixel has a luminance value between 0.8 and 0.9 has tapering transparency.
Let’s go back to rgb. Press the A key again, and there we go. Now, it doesn’t look like anything is happening right now. What you have to do with the Keyer is premultiply the alpha. So, I will select the Keyer node, right-mouse-button-click, Merge > Premult. Premult multiplies the alpha values by the rgb values. Once I add this, the sky is removed. Now I can test this further. I can hook something up to the B pipe of the Merge. For example, I can right-mouse-button-click, and go to Image > Constant. Constant will produce a solid color - I will hook that up to the B pipe. Then go to the color wheel for that node and pick a color, like light blue. The sky is gone and now the Constant appears in the sky area.
Let’s move on to some other keyers. I am going to go back to the greenscreen footage. Now, in fact, you can have more than one Viewer in any project. You can make a new Viewer at any time by going to the Viewer > Create New Viewer (Ctrl/Cmd+I). If you have more than one Viewer, you can switch between them by clicking the tabs. So now, we are going to work on this greenscreen. The first keyer we will try here is Keylight, so Keyer > Keylight. Foundry writes Keylight and, in fact, it is available in other compositing packages like After Effects, the functionality is the same. It looks a little intimidating at the start because of all the inputs. What you have to do is plug the Source into the greenscreen, in this case, the A pipe into the output. Now there are many options you can adjust. I am going to adjust the basic ones you need to remove the greenscreen. The first thing to do is select the Screen Colour. You can click the swatch here, get the eyedropper, and go back to the Viewer. There are several ways to sample pixels with the eyedropper. You can Ctrl/Cmd+click or Ctrl/Cmd+drag your mouse. I will try the drag, so click+drag, let go - the screen color is sampled and you will see it right here in the swatch, and also beside the Screen Colour property. Let’s take a look at the alpha. Now, Keylight offers this View menu, which you can change from Final Result to Combined Matte. That’s what the alpha channel looks like, so right now there is some gray in the transparent area. What you can do is raise the Clip Black to erode that. What the Clip Black does is it looks for any pixel less than the slider and it makes it 100% transparent. There is also some gray in the white area. You can lower Clip White to make them more opaque, and now the matte looks pretty good. Once the matte looks good, you can return the View to Final Result. Now, to test that, I will disconnect the Constant over here, and plug it into the B pipe here. There we go, that’s pretty successful. Let’s try another keyer. I am going to disconnect Keylight, disconnect constant, and move that aside.
Now we will try Primatte. Primatte has been updated for Nuke 7, so now it’s even more powerful. In this case, I need to hook the fg or foreground to the greenscreen and then the output to the A pipe. Primatte has a very powerful button called Auto-Compute. If you click that, it will attempt to identify the screen color and remove it. In fact, it does a really good job right off the bat. Let’s see what the alpha looks like. I will press the A key again, and there it is. Again, there is some noise around the edges. Fortunately, Primatte offers a long list of operations you can use to clean up the matte. For example, I can switch this menu to Clean BG Noise. Now I will zoom in, and now, I can sample those pixels that are too gray. Another way to sample is to Ctrl/Cmd+Shift and draw a marquee box around the problem area that samples a whole bunch of pixels at once.
So now the edges are looking better, but there is still some gray on his jacket. We can then switch the menu to Clean FG Noise and then sample those pixels. Now that becomes more opaque. Let’s take a look at the rgb again. Press the A key - there it is. It looks pretty clean, however, there is a lot of green spill from the greenscreen in his clothing. In that case, I can go to Spill Sponge and sample those pixels to pull the green back out. There it goes. Now it’s not perfect yet, but you can see how quickly you can move the green. Let’s go ahead and plug in the Constant though and see what that looks like. Alright, let's move on to one more keyer. I will disconnect this one, move it aside.
Now we are going to try the IBKGizmo and IBKColor: two nodes that are designed to work together to tackle greenscreen or bluescreen. So Keyer > IBKColour and Keyer > IBKGizmo. Now, the connections here are a little bit more complicated. Basically, the 1 input for the IBKColor goes into the greenscreen, as does the fg for the IBKGizmo. Then the c, or color input pipe for the IBKGizmo, goes to the IBKColor node. Then the A pipe for the Merge goes to the output of the IBKGizmo. Let’s take a look at the options. The first thing to change is the screen type for the IBKColor node. It is set to blue by default, but you can change it to green. That looks a little funny here in the Viewer, but what I can do to see what the IBKColor node is doing is plug the Viewer into that node. Here, it’s targeting the color green; whatever color is not green it’s removing. Now the aggressiveness of the removal is controlled by the size slider. If I increase that, there is more averaging and there is fewer and fewer non-green colors. Let’s plug the Viewer back into the IBKGizmo. The color information is passed from the IBKColor node to the IBKGizmo node, which the IBKGizmo node turns into a matte. Now the first thing you need to do with the IBKGizmo is make sure the screen type is set to the same color, in this case, green. Let’s plug the Constant into the B pipe and put the Viewer back to the Merge node, and there we go - successful greenscreen removal.
Now, I know all of these keyers have numerous options, which we didn't talk about. This is just to give you a brief introduction and to show you there is a wide range of keyers to tackle pretty much any type of footage.
“Tears of Steel” footage courtesy (CC) Blender Foundation - mango.blender.org