- [Instructor] Now that we have a firm grasp
of both nuke channels and the merge node,
we can work them together to see how a multi-pass CG element
with several lighting passes would be composited.
We'll be using our familiar multi-pass head
and recall, that it has a reflection pass,
a specular pass, and of course the diffuse pass
is in the RGBA layer.
We also have a masks layer.
And in here, I have a grunge pass.
This puts noise and dirt on the picture.
The ambient occlusion, and these are all one channel images.
And here, I have the shadow pass, again, one channel images.
Alright, so let's put all of this together.
We'll start by selecting our Read node
and I'm going to add a Merge node
by using the keyboard shortcut.
So I'll type M on the keyboard.
And as you know now,
the merge node hooks the A side up
to whatever node is currently selected.
So I need to take the diffuse lighting paths
which is in the RGBA layer and add it
to the reflection pass.
Now, the RGBA layer with the diffuse is right here,
and I have to hook the B side up
to the source of the reflection pass.
And that of course is in the same node.
So oddly, I'm hooking both inputs to the Read node.
I'll set my operation for plus,
because lighting passes are added together.
And then on the A side, I want to use the RGBA layer
containing my diffusion pass,
and on the B side, I want to use the reflection layer.
And now I've added diffuse and reflection together
and you can see that here if I toggle this on and off.
Okay.
Next, let's add in the specular layer.
Once again, I'll type M on the keyboard to get a Merge node.
And of course, my specular layer's coming
from the same source, so I'm going to take my B side
and hook it up there.
Again, change my operation to plus.
This time, I'll tell the B channels
I want to get the specular layer, and that's added in.
If I turn off this Merge node, I lose my reflection.
If I turn off that node, I'm losing the specular,
and I'm seeing just the diffuse.
So you can see, they're adding together,
building up a lighting passes.
As I add these lighting passes,
the output is put back into the RGBA layer.
So the RGBA layer is accumulating
all the lighting passes together.
I still have my original reflection and specular passes.
They've not gone away, but I have lost my diffuse.
It's being added with all the others.
Next, let's put in our occlusion pass.
The way we'll do that is we have to do a multiply
and we just need the one occlusion channel
from that masks layer.
So I'm going to select Merge node,
come over here to the Color tab,
and select from the Math popup, a Multiply node.
Now the channels I want to multiply
are not all the channels,
because I do not want to disturb my alpha channel.
So, I just want to multiply the RGB channels.
The value I want to multiply them will be zero,
but I'll mask it off with the occlusion channel
of the masks layer.
Oops, that's backwards!
So I'll have to invert that mask.
So I just come up here, slide over, and click invert.
And there we go.
There's my occlusion pass multiplied
by all my lighting passes.
Next, the shadow pass.
It's the exact same setup.
Go back, get a Multiply node.
Tell it that the channel I want is just RGB, value to zero.
This time I'll select the shadow channel
from the masks layer.
And again, invert it, like so.
And there's my shadow pass.
Next, let's do the grunge pass
and that can also be another multiply.
So we'll go get a Math, Multiply.
Set the channels to RGB, value to zero,
mask it with the grunge channel of the masks layer.
Not inverted, this time the polarity was fine.
And I can dial in how much grunge I have right here.
Well, we're good to go.
Since this is now in the RGB layer
and I have a nice alpha channel,
I am ready to comp this.
So I'll just select this multiply node,
type M to get a Merge node, hook up the background,
and now we can all go home.
The big advantage with using Nuke's channels
is that it makes a cleaner, simpler node graph
which is very important
when working on large, complex visual effects shots.
Without channels, there would be multiple Read nodes
with data pipes running all over the Node Graph.