Keyer
This node gives you access to several simple keyers. You can use it to pull keys based on the input image’s:
• red, green, or blue channel,
• redscreen, greenscreen, or bluescreen,
• luminance (the default),
• saturation, or
• maximum and minimum values.
To use this node, view the alpha channel in the Viewer. Then, use the range graph to adjust the low and high pixel values of the matte. The A handle determines the low or transparent values of the key: any pixels that fall below this value are clipped to black. The B handle determines your high or opaque values: pixel values above this setting are clipped to white.
The default positions let you control the low and high values, assuming your image has distinct light and dark areas. However, sometimes the subject of the matte falls into the “middle-gray” area; the C and D handles let you shift the center for the high values of the key.
Inputs and Controls
Connection Type |
Connection Name |
Function |
Input |
unnamed |
The image sequence to key. |
Control (UI) |
Knob (Scripting) |
Default Value |
Function |
Keyer Tab |
|||
input |
input |
rgb |
Select the layer you want to use for keying. |
output |
N/A |
enabled |
Enables the associated output channel to the right. Disabling this checkbox is the same as setting the channel to none. |
output |
rgba.alpha |
Render the resulting image into this output channel. |
|
replace |
combine |
replace |
Select how you want to combine the matte with the existing output channels. • replace - replace the existing output channels with the matte • intersect - create an intersection of the matte and the existing channels. • union - create a combination of the matte and the existing channels. |
invert |
invert |
disabled |
Inverts the use of the alpha channel so that the result is a non-white matte. |
operation |
operation |
luminance key |
Select which keying tool you want to use for keying your sequence: • red keyer - use the red channel to pull the key. • green keyer - use the green channel to pull the key. • blue keyer - use the blue channel to pull the key. • redscreen - subtract the red channel from other channels. • greenscreen - subtract the green channel from other channels. • bluescreen - subtract the blue channel from other channels. • luminance key - use the luminance value to pull the key. • saturation key - use the saturation value to pull the key. • max keyer - use the maximum values of the red, green and blue channels to pull the key. • min keyer - use the minimum values of the red, green and blue channels to pull the key. |
range |
range |
N/A |
Drag the A, B, C, and D delimiter handles in the graph to adjust your keying result. The A delimiter marks the value where you want the keying to start, the distance between B and C mark the length of the full effect and delimiter D indicates where the effect stops. |
A |
range |
1 |
Enter the value for delimiter A in the range graph. You can also drag the handle in the graph. |
B |
range |
1 |
Enter the value for delimiter B in the range graph. You can also drag the handle in the graph. |
C |
range |
1 |
Enter the value for delimiter C in the range graph. You can also drag the handle in the graph. |
D |
range |
1 |
Enter the value for delimiter D in the range graph. You can also drag the handle in the graph. |
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