- [Instructor] You can add materials and textures
to your 3D geometry using Nuke's shaders
to achieve photorealistic renders.
The Phong shader is the Swiss army knife
of the shaders as it incorporates three shaders in one.
To ease into it, we'll look at the diffuse shader first,
then step up to the Phong shader.
You may recall that if you add a texture map
to a geometry with a light, you get an 18% diffuse shader
but there's no adjustment.
So, if we want to dial in our diffuse,
we're going to have to add a diffuse shader.
We come over to the 3D Menu, Shader,
come down to Diffuse and we'll bring it here.
Now watch what happens when I hook the geometry directly
to the diffuse node.
We lose our texture map and what we're seeing
is an 18% diffuse render of the raw geometry,
sort of a white billiard ball.
Down here is our diffuse shader value, .18%.
I can dial it down and dial it up
or turn that back to default.
If I connect an image to the map input,
this becomes a texture map
with an 18% diffuse shading model.
Now I can adjust the diffuse level up or down,
giving me the kind of control I don't have
if I just have the texture map connected directly
to the geometry.
Let me dial this up a little bit
to show you something about the 3D version.
If we look in the 3D view,
we're seeing the OpenGL version
and it's not a very close match to the 2D render.
So when you're dialing in your materials,
be sure you're looking at the 2D render.
So what's this unlabeled input here on the diffuse node?
Well, that's where you can pipe in other materials
or a picture and it will simply add
whatever's on this input to the output of the diffuse node.
So if I hook up this checkerboard pattern,
now the checkerboard is simply being added
to my diffuse texture map.
That's ugly, so we'll take that off.
In the shader pop-up menu,
there's actually three different shaders available,
the diffuse, the emission, and the specular,
and you can stack them together
to create complex shading models.
Now, these are older shaders that are retained
for backward compatibility.
If you want to use diffuse, emission, and specular,
you can do it all in one node, the Phong node.
So let's take a look at that.
I'm going to hook up my viewer to this.
So with nothing connected to the geometry,
I get no rendered image.
So I'm going to go get my Phong node, 3D, Shader, Phong.
Now if I hook the sphere up to this,
I get something similar.
By default, the Phong shader has got
the emission lighting model set to zero,
diffuse to .18 or 18%, exactly like the diffuse node,
but it also now has a specular, by default, .08.
So if I dial down the diffuse, we can see the specular.
And of course, we can dial the specular up and down
and I can dial the emission up and down.
So what's emission?
Other software may call this an ambient lighting model.
It's simply a constant that's being added
over the entire picture to help fill
in these totally black areas here.
It'll look a lot nicer with a texture map.
So if I'd like to texture map this
with a diffuse lighting model,
I'm going to take and hook up the mapD,
so that's texture map for diffuse, to an image.
Let me dial up my diffuse level.
That's much better.
Now my specular highlight is still the white geometry
because I have not connected a texture map
to the specular input.
So let's fix that by taking mapS,
the texture map for the specular, and hooking that up.
Now I can dial up my specular values
and I get a shiny spot that uses the exact same texture.
And we have the min and max shininess adjustments here
so we can make it as broad or as tight as we want.
Next, I'm going to add a texture map
to the emission, mapE, input there.
There you go, mapE.
And now, as I dial up the emission,
watch these black areas in here fill in quite nicely,
thank you very much.
Here we go.
Now, there's also this color slider here.
I'm going to open that up and give it a severe color change.
This color is applied to the diffuse material only,
not to the emission and not to the specular.
I'm going to undo that.
One more input for you to know about.
The mapSH, that's the map shininess.
I have this here black and white image.
I'm going to use that as a shininess map
to my scanline render node here
and hook that up to the map shininess input
of the Phone shader.
What that means is it's going to modify the shininess
of the surface.
Where the map is white, it's going to gravitate
towards the max shininess value,
and where the map is dark, it's going to turn
to the min shininess value.
I'm going to disconnect that 'cause that ain't purty.
Now, I've used the same image as the texture map input
for all three of map inputs of the Phong shader,
but that's not necessary.
You can put any map you want on any one of these inputs.
For example, I'll take the diffuse input here
and hook it up to my checkerboard
and now the diffuse material contains the checkerboard
instead of my very attractive stone.
Just like the diffuse node, this will bring
in any other shaders you want and will simply summon them
with the output of the Phong node.
This is the basic material node, and if I open this up
in the property panel, you can see it looks identical
with the Phong shader.
But don't be fooled.
It's not.
The basic material is an older node
that uses gouraud shaders, where as the Phong node uses
the more modern and more photorealistic Phong shading model.
So the basic material node is retained
for downward compatibility to older Nuke scripts.
The Phong shader allows you to not only dial
in separate emission, diffuse, and specular materials,
but also allows you to connect different maps
to each of these inputs for maximum creative control.