Join Steve Wright for an in-depth discussion in this video Unleashing the power of your luma keys, part of VFX Keying: Master Course.
- [Instructor] When compositing visual effects shots we constantly need to isolate arbitrary objects for special processing operations like color correction or a blur, so this chapter is about a million ways to key. The overarching strategy is to look at a target object and ask yourself how is it different than the rest of the shot, then formulate a keying strategy based on that difference. Our first and most common keying technique is the ever-popular lumakey, which keys on the brightness of an object.
While extremely useful, it has limitations and often does not give good edge quality. If you'd like to review Nuke's lumakeyer in the Keyer node, you can find it in my Nuke Essential Training course, Chapter 10, Keying. Here we'll see several techniques to increase the quality of a lumakey and therefore its usefulness to you and your compositing work. First up, don't over-adjust. Let me show you what I mean. When you're pulling a lumakey, you're pulling down on the blacks, let me switch my Viewer to the alpha channel, to clear them to solid black.
Well the problem is the Keyer clips black and whites in the alpha channel, so I can overshoot, overshoot an keep going and keep going and never know it, and as I do, I am hardening my edges, making my key worse and worse. Same thing for pulling up on the whites. OK, I can just keep overdoing it, and it never goes above one, you can see down here my code value for the alpha channel is one here and zero there, no matter how hard I crank.
So you have no clue that you've overshot, and you're hardening up your key. So... what we do is put these back, we do some gamma-slamming, so that we can keep an eye on things. So let me re-hone the Viewer, and I'm going to set the Viewer gamma to three, so I'm going to gamma up the Viewer, and pull down on the blacks. Now as the blacks clear out, I can tell I want to get the blacks cleared just ever so gently till the last little particle of noise, in fact, I even leave in just a tiny bit of noise, that way I know I'm right on the cusp.
OK, Viewer gamma down to pull up on the whites. So we'll come up here and pull up on the whites. Now we don't want to overshoot, so let's put a RGB sampler there and watch my alpha channel right here while I gently approach 1.0, there, and stop. OK, restore normal Viewer gamma. So I have assured myself that I have not overshot and hardened the edges any more than I have to.
OK, let's go back to the RGB layer and cruise over here to take a look at noise. Noise is in virtually all of our images, and it degrades the quality of your lumakey. Let me show you right here. Let's pull a key on this guy, switching the Viewer to the alpha channel. Viewer gamma up. Blacks down. Here we are, and just until my noise almost disappears.
There we are. OK, Viewer gamma down to pull up on the whites. Again, RGB sample, watching my alpha values here very carefully as I creep up on 1.0, and make sure I don't overshoot. And... Creeping, and creeping, and... There we are. OK, restoring Viewer gamma. So this is the best I could do with the noise in the picture and I get this kind of chewy, noisy edge like I would expect.
And of course when this footage is playing, this edge is going to sizzle. All right, no matter how good that sounds, you don't like sizzling edges. Let's go back to the RGB side and we'll take a look at this De-noise node here to knock down the noise. All right, so let's try to key this one, so we'll open up our lumakey. Gamma up the Viewer. Pull down on our blacks after we switch the Viewer to alpha.
OK, just a tiniest bit of noise left. Viewer gamma down. Pull up on our whites. Got a sampler going so we can keep an eye on our code values. Walking to 1.0 without crossing. There we go, 1.0. All right, let's put our Viewer back to normal. And now let's compare the two, let's push in.
So here's the original noisy one, and here is the de-noised, so you can see we got not only a lot more meat at the edge of our key, but it's also a lot smoother, and therefore less chatter. So cutting out the noise will help you to not have to chew into the key so much. In fact, look at the code values here. Here is the original one with the noise, I had to pull this up to 245 to clear out the blacks. And here I only had to pull it up to .227, so I didn't have to crank so hard on those blacks.
Very good, better edges, better keys. All right, enough of noise. Now in the real world, let me set the Viewer back to RGB and hook into this guy, in the real world the background is not going to be uniform, it's going to have some kind of gradient to it, so let me gamma down the Viewer. You can see here, dark on the left, lighter on the right. In fact, over on the left, my code values are around .21, and over on the right, it's like .48.
So there's like a .27 difference in code value across the top, and we can see that with the Sampler node. Show you that right there. So the Sampler is wacking a line across here and plotting the RGB values so you can actually see the slope in that background. OK, so we'll put away our Sampler. So what are we going to do about that? We're going to apply a counter gradient in order to even up the background.
But first let's pull a key on the original and see what happens. So let me open up the Keyer. Again, Viewer gamma up. Blacks down, after I switch the Viewer to alpha channel. Down, down, down, and you can see my gradient is slowly wiping away, but I have to pull it really hard to clear that last bit out. Ooh, look at that .489. OK, Viewer gamma down.
Pull up on the whites. Again a sample box so I can watch my RGB, keep an eye on my alpha channel as I creep up to 1.0 without blowing over. There we go. OK, restore Viewer gamma, and this is the key that I got. OK, got some nice, soft edges, it looks pretty good. Now let's return back to RGB view, re-hone the Viewer, and this ramp here is an exact counter gradient to the background, OK? You remember it got brighter to the right, so I made a ramp that got brighter to the right, and I'm going to subtract it.
So the original image minus this gradient will get me this flat background. So on the right I got about .21, on the left I have about .21. So now let's try to key this and see what happens. All right, so Viewer to alpha channel, and we'll set our Viewer gamma to three, gamma up. Blacks down.
I better hook my Viewer up to the Keyer, don't you think? Hehe. OK, I overshot, so here I am, now it's flat, it should be fairly, yeah, see, it's almost perfectly flat. OK, there you go, just a little bit left. OK, Viewer gamma down. Pull up on our whites. Now adding that gradient, that tilt to the picture, this is no longer flat, so I have to keep an eye on the darker part here.
OK, you see the 1.0 is walking across, so I'm going to put a Sampler right on this edge, so I can make sure this guy goes to 1.0 and I don't overshoot. So let's creep up to that, watching our code values down here, my alpha. And walking up, there we go. OK, reset my Viewer, restore the Viewer gamma. Now let's compare before and after. Before, and after, a huge difference.
Well now let's apply these ideas to a real-world case, OK? So Viewer back to RGB, let's look at a cloud. Now we've got film grain, and like every single sky shot you'll ever work with, it has a gradient in the background. Skies will be darker at the top, lighter and less saturated at the bottom. So let's try pulling a key on the original source image right here, OK? So I'm going to switch my Viewer to the alpha channel.
Gamma up. Blacks down, and I have to keep going until I clear all the noise out of here. So let me inch my way up there, slowly and there, let's call that good. Viewer gamma back to normal. I'm not going to adjust the whites because our real point is clearing out the blacks. OK, now let's take a look at the de-noised one here. Let's try to key that one.
So Viewer gamma up. Blacks down. Clearing, clearing. There we go. Restore Viewer gamma. And now let's compare the noisy one to the clean one, and you can see we picked up lots of nice edge detail, and it's also not going to be buzzy and chewy while the clip is moving. Well that really helped, but wait, there's more.
Now let's take a look at what happens when we de-grain it and we level it with a counter gradient. So I measured the RGB values at the bottom and the top, figured out the difference, and I simply made a ramp that matched that gradient. Again, each RGB value had to be different, of course, because each channel is a different value, unlike the gray images we saw a minute ago. So if I take this image, and I add this gradient to it, it will even out the background like that.
See, now the code values up here and down there are very similar. My backing region is now pretty darn flat, I'm ready for my lumakey. So let's pull a lumakey on this. Switch Viewer to alpha. Gamma-slamming up to three. Pulling down on our blacks to clear it out. There we are. Restore Viewer gamma.
Now let's compare the leveled one with the de-grained one. Huge difference, look at all the extra detail I got. All over the place, detail everywhere on the leveled one. And then we compare to the original noisy one, and the difference is even more dramatic. OK. So, pre-processing a plate to sweeten it for a lumakey dramatically improves the quality of those keys and therefore the usefulness of lumakeying in your work.
However, that's just the beginning. In the next video, we'll see even more techniques to make lumakeys even more useful to you.
Note: This course was created by Steve Wright, author of the seminal book, Digital Compositing for Film and Video. We are proud to host this course in our library.
- Creating an uber key
- Keying green-screen vs. blue-screen footage
- Preprocessing footage
- Building a clean plate
- Making luma keys
- Keying on hue and saturation
- Pasting keys together
- Grain management
- Saving time with garbage mattes
- Using spill suppression
- Improving edges
- Color correcting keys
- Sweetening the comp
- Alternative compositing workflows
- Fixing edge problems
- Using KEYLIGHT, Primatte, Ultimatte, and other tools