Learn the secrets of the Grade node, including little-known features that improve productivity and help you stay out of color trouble. Learn about reverse, black clamp, white clamp, unpremult, and mix luminance.
- [Steve] Hi, this is Steve Wright, welcoming you to this week's Nuke Nugget, Secrets of the Grade Node that will not only improve your comps but also keep you out of color trouble. The grade node is one of the most used nodes in Nuke. But in the rush of production we often don't take the time to learn all about it. By looking into all its secret nooks and crannies we'll not only discover some useful new features but also avoid introducing color problems into your comps. So, let's cruise over here and start off by taking a look at the reverse feature.
I'll open up this grade node and we're talking about this guy right here. So, you've got an image and you've applied some sort of a grade operation to it. This is a particularly hideous example. Then you perform some additional operation. So what we would like to do now is invert or reverse that grade back to the original. So, we just copy the grade node and we paste it right here. Then we set it for reverse. Now, we've got it right back to the original image.
It's performed the perfect inverse of the original grade operation. Okay, next. Let's take a look at the black clamp. I want to hook up to this dpx image. Now, this dpx image contains log data. Most log images have negative code values. Looky here. In the blacks you'll find lots of negative code values. The grade node will clip them out. You will lose if the black clamp is on.
Now we look up here and everybody has gone positive or they clamped to zero. So if you're working with limited dynamic range images like sRGB or rec. 709 you can leave the black clamp on. But, if you're working with log images that contain negative code values you'd better turn it off or you're going to lose them as they come through the grade node. Next, let's take a look at the white clamp. Now, in this image here I've got some high dynamic range data up in the sky.
You can see I've got 1.2, 1.6 so I've got some very, very high code values up here. Let's switch the grade node here. There is my white clamp feature. If I turn it on, I'm going to clamp all of my high dynamic range values to 1.0. So the general rule is for regular images you want the white clamp off. However, let's say we're going to work with the alpha channel here, okay.
Now, the alpha channel, you remember the rule must stay between zero and 1.0. Right now, everything is hunky-dory, code value one. But, let's say I took my grade node and I gained up the alpha channel 'cause I want to clear some stuff out. Now, with the white clamp turned off now my alpha channel has gone silly, 2.0. Okay, so, you must turn the white clamp on. That's really what it was intended for.
When you're working with the alpha channel or keys or anything like that you want the black and white clamps on to keep you between zero and one. Okay, back to RGB. Re-home the viewer. Now let's come over here and take a look at the mask settings in this grade node. We're talking right here, the mask and these inject, invert and fringe options. Now, I've connected a roto to the mask input of the grade node. Which, as you know, will immediately wake up that mask input like that.
Now let's take a look at these features that come with it. By default, this mask is used by the grade node but it proceeds no further. It is not propagated down out of the grade node. It stops right there. There are times, however, when you would like to use it downstream of the node. Now we can always keep hooking up mask inputs to that same roto. But, the foundry put in a special channel just for you for masks that you want to use in the local area.
And that's the mask.a channel. Now if we look up here in the channel list we do not see a mask.a. If it has not been populated with any data it sits over here in other channels. There it is. So it's pre-defined, but at the moment there's nothing in it. So it doesn't show up in the main channel list. However, if I turn on inject that means take the mask coming in from this input and inject it into the mask.a channel. Now it's accessible and available to nodes below.
And it goes like this. You can see the mask.a channel is now alive. We'll select that, which puts it into the viewer's alpha channel. We switch the viewer and there it is. I turn this off, it disappears out of the mask.a. So, putting the viewer back to RGB. Now I have a channel available downstream. So if I open up this blur node and let's say I give it a blur of 10 it's going to hit the whole picture, right? But then, I tell it to use the mask.a channel and now the blur is masked off.
Okay, so that's the mask.a story. Let's turn off the inject feature. Go back to our grade node. I'm going to set the gamma silly high to like two. And it's being masked by our alpha channel. And the next feature invert, of course simply inverts the use of the mask. It does not invert the mask itself just the mathematics involved in the use of it. But we all know about that. But what's this fringe thing? This is interesting, what's going on here? I'll show you what's going on there.
Let's push in here. I'm going to switch to my roto node. Bring back my mask.a and look at the roto mask here. Okay. The fringe is addressing these pixels here around the edge. The pixels of the mask can be sorted into three groups. The solid pixel's 1.0. The transparent pixel's of zero. And all of those that are between zero and one the semi-transparent pixels.
What fringe does is it makes a mask out of just the semi-transparent pixels. Alright, so, let's see what that does for us. Right here, if I turn on fringe only the edges will get the color correction. Now this can be very useful if the edges of a masked element are looking a little funny. So you can set the grade node to fringe and just dial in the edges affecting no other part of the picture.
Nifty, eh? Okay, the unpremultiply feature. Let's cruise over here, open up this grade node. What I have, is I've got a from my original picture I used a roto node to perform a mask operation and a premultiply. So I now have a four channel premultiplied image. That goes to this grade node here to the comp there. Now here's the rule.
All premultiplied images must first be unpremultiplied before they get a color correction and then premultiplied afterwards. So the foundry has built that sequence into every single color node. Not just the grade node here. But every node in the color tab has this feature. So it's performing this sequence of operations here inside the grade node with no penalty in time or performance. So what happens if you get it wrong? I'm going to turn this off.
Look at what happened to my edges. See that? So if you get it wrong you're going to mess up your edges and introduce edge artifacts into your comp. So, always remember the rule. When working with unpremultiplied images make sure you have enabled the unpremult by alpha. Okay, our last feature is the mix luminance. So let's hook up here. Re-home the viewer.
Turn on this second viewer here and I'm going to split my pane and move one viewer over there. And re-home, re-home. Alright, so here's the story on the mix luminance right here. A couple of versions back the foundry added this feature. And it has been added to every single color node in this list. So here's the story. Any time you adjust the RGB values of an image you are also altering its luminance.
I'll demonstrate that for you here. This viewer, I want to set to luminance only. This one, it's got the original RGB image. Now let's see what happens when I alter my RGB values. Since green is the biggest component of luminance any change to green is going to have a big effect on the luminance. So, watching my luminance image here I'm going to pop up my green. Boom, the luminance went way up. If I drop the green down I lost a lot of luminance. Very often you do not want that to happen.
So, if you want to preserve the luminance set the mix luminance to one. Now, when I change the RGB values luminance will be preserved. Again, pop up the green. No change to the luminance. Drop the green, no change. By default, it's set to zero. Meaning, you're going to affect your luminance every time you change your RGB values. So, if you want to preserve it set the mix luminance to one.
So there you have it. The secrets of the grade node that will improve your productivity and keep you out of color trouble. Be sure to check in next week so you don't miss out on my next Nuke Nugget.
What kinds of NUKE tips do you need? Join the Steve Wright's NUKE NUGGETS group on LinkedIn, and post your requests there.