From the course: Nuke Essential Training (2014)

The Keymix node

The KeyMix node is a specialty node for compositing two images together. It's specifically designed for the case where you have three separate images: a foreground image, a background image and a separate mask to determine the composite. So here's the basic setup. We have the foreground image connected to the A Input. The background image connected to the B Input, and the mask connected to the, mask input. Now the foreground image, is a three channel image. As you can see, there's no alpha. As in this case, so is the background image. Typically, that'll be your set up. You'll have a three channel foreground, a three channel background, and a mask. The KeyMix node does an over operation, and that is the only operation. You don't have a choice like you do with the merge node. And again, the basic application is if you want to isolate something out of one plate and comp it over another plate. That's the purpose of the KeyMix node. Important point is, that the foreground image to the KeyMix node be a unpremultiplied image. Now the merge node wants a premultiplied image. But the KeyMix mode wants an unpremultiplied image. If you accidentally give it a premultiplied it's going to do a double premultipliy resulting in dark edges around your composite. Another important difference between the KeyMix and the merge node. As we saw in the merge node video, the output of the merge node includes the alpha channel of the A-side input. But that is not the case with the KeyMix node. You don't get no alpha output. Looking over here at the Property panel, we start with the channels. These are the channels of the A side input. If there were multiple layers, you could pick them from the pop-up list. Next is the mask channel. This mask channel, of course, pertains to this mask input here, and it's asking what channel is your mask in? By the way, this little toggle here allows you to do a quick toggle on and off so you can do easy compares before and after. So here's where you choose the mask channel. One, that mask input could have three, four, five, 17 channels. So you pick the one you want by default, it's going to be the alpha channel, but you could for example have your mask in the green channel of the input image. Whatever you want. And last is the mix control. Moving this slider allows you to make semi-transparent composites. One more important point about the KeyMix node is, it is the b side input that controls the output size. For example, this A input is only 358 scan lines high. The B input is five 553 scan lines high. And the output is 553 scan lines. So it's the B side that controls the output resolution of the KeyMix node. Use the KeyMix node to lift an element out of one frame and comp it over another. The key is that you use separate mask element, it does not matter how that mask is created. It could be a roto, as in this case, or any kind of key such as a luma key or chroma key. However, if you want more control over the edges of your composite, then you'll want to use the admix node, the subject of our next video.

Contents