Tip:
Highlight text to annotate it
X
In this video I want to talk about three of the mental ray basic shading models;
the mental ray materials are located in the visor here,
right under “mental ray materials”. The materials are typically divided into different libraries;
the “mib” library is the mental images basic library,
and that’s the one we’re going to focus on.
There is also the “mi s-s-s” library, which is the subsurface scattering shaders,
and there’s the “mia” materials which would be the architectural materials,
and there’s the mi Car Paint
and a few other ones that we can talk about later.
But for now, looking at the basic shaders and the ones that I want to talk about are the
Phong, which we’re familiar with from Maya,
the “Blinn”, which we’re also familiar with, and then there’s one specific to mental ray
called the “Cook-Torrence”. The mental ray basic shaders are known as
“Component Shaders”; I have the Phong shader selected here, and you can see that
there’s not a lot of attributes associated with this shader –
there’s Ambience, Ambient, Diffuse and
Specular, and in the case of the Phong
material the “exponent” will control the tightness or the focus of the specular highlight; it corresponds loosely to the
cosine power of the Maya phong material. The mental ray basic shaders are known as “Component Shaders”,
and the attributes that you see here are really all that you get,
and they only represent the specular and diffuse components of a larger shader model.
Corresponding shaders in Maya are known as “Monolithic” shaders,
where they have all the components built in, whether you need them or not.
The Maya Phong contains transparency, reflectivity, reflection mapping, bump mapping,
and all those other attributes. With mental ray it’s kind of a “bare bones”,
and if you want all those things you have to build them in.
There are some advantages and disadvantages to both methods.
So in this video I want to talk about these basic components,
and primarily how they respond to light, and how they return light values to you in a render.
So in order to demonstrate that what I’ve got in my perspective window is a
NURBS plane; nothing fancy about it, and then I have a Maya “area light” shining on that
plane, which is set to 90° to the plane and it’s really set up this way for purposes of this
demonstration. I’ve set the intensity of this area light to higher than I normally would
for a render and I’ve set up in the mental ray rollout I’ve set up the light so I can see the light shape,
and that’s for the purpose of seeing specular reflections and that sort of thing.
So here, this is what the shading model looks like by default,
So I want to start off by explaining what each of these attributes does, you should be pretty familiar with them anyway but
they do bear a little explanation here.
The “Ambient” and the “Ambience” are two values that get multiplied together when evaluating the shader.
One is designed to be a color, and the other is designed to be a multiplier –
so typically what we’ll see (let me just turn down the diffuse and the specular here
so we’re only dealing with the Ambience), and
I’ll just do an IPR render here.
So the “Ambience” – you could call this a color –
let’s give it a sort of red ambience here,
And that's going to get multiplied by this ambient factor,
So if it's zero, of course it'll be black, and if it's one it's going to be completely red.
This attribute exists outside of any lighting – you can see that there’s really no illumination coming from the area light here.
So this is kind of like an environmental light, it’s used to simulate a little bounced light but
it also can make this shader look a little bit self-illuminating.
For now, I’m going to turn these down to zero.
Notice, by the way, that my sample here and the sample inside my Hypershade window
has turned bright red, and I think that’s just an anomaly caused by my graphics card.
Trying to display the Hypershade with this sampling
along with the pretty robust functionality of the IPR
is a little too much for my computer.
So that’s why this turns red – it’s nothing to worry about.
So let’s take a look at the diffuse.
I’m going to turn the diffuse attribute up, and you can see how the diffuse spreads out along the surface.
What we know about the diffuse is that it respects Lambert’s Cosine Law,
the cosine law means that the angle of the light relative to the angle of the surface normal
is the deciding factor as to how much or at what rate this light gets absorbed. So as I change the angle of my scene,
you can see that the diffuse doesn’t change at all.
No matter what angle – whether I’m at a facing angle like this or at a complete glancing angle like this,
my diffuse attribute doesn’t change because the angle of the light relative to the surface normal doesn’t change regardless of my
camera position.
In this example, I’ve taken the diffuse attribute and turned that all the way down to zero,
and I’ve increased the specular; my purpose is only to isolate one of these attributes against the other
so we can see how they behave.
As I change the angle of my camera view, you can see that when I approach an angle
close to 90° my specular highlight is fairly small,
and when I look at this from a more glancing angle my specular reflection gets a little
more elongated. So the specular component of this shader is angle-dependent
relative to my “eye-ray”, or the angle at which the camera is looking at the surface,
whereas the diffuse is based on the angle of the light relative to the surface.
So that’s a pretty important distinction. The other attribute or the other aspect of the specular highlight
is that it’s affected by this “exponent”, so when the exponent is turned down
the specular highlight spreads out more, and becomes a much more diffuse highlight;
when it is turned up, we get a tighter, more focused highlight.
Now one missing component here is any sort of raytrace reflection of my light,
and the reason for that is that my Phong material is a component shader,
and there is no reflection attribute built in
and if we this to be reflective we have to add a reflection component.
Let’s compare that for a minute to the Maya Phong material; when I add that you can see
that because this Maya Phong material is a monolithic shader it has the reflectivity built in,
so it will give me a natural raytrace reflection of the light.
So here I’ve replaced my Phong material with a Blinn material
and in the attributes here I’ve turned the ambience and ambient down to zero
because they’re exactly the same (as the Phong); I’ve turned the specular component
down to zero and I’ve just increased the Diffuse component, and you can see that this is exactly the same as the Phong –
the spread of the Diffuse or the absorbance of the light on this material is
based on the angle of the light relative to the surface normals, so as I change my camera angle
nothing changes with the light absorbance.
I’m going to turn the Diffuse down to zero and turn the specular up,
and you can see that I get a very faint specular highlight here –
maybe let’s just increase that a little more and maybe I can turn my light up just a little bit –
so there’s a couple things happening here.
Notice that the Blinn has a roughness factor and it has an Index of Refraction.
So the roughness will spread out this Blinn, it makes it a softer edge, more “glossy”
reflection, as I turn the roughness down this will all but disappear.
The other important attribute here is the Index of Refraction.
We know from working with glass that the Index of Refraction has to do with the
bending of light rays when they strike a surface; when we’re dealing with glass or other transparent surfaces,
the light will bend based on the Index of Refraction as it transmits through the glass,
or as it goes through the transparent part of the glass –
but in this case it bends as it reflects off of the surface. So if I increase the
Index of Refraction, you’ll see that I get a little brighter highlight.
Probably more important than this, though, is the fact that when I change the angle of view here, my highlight gets brighter.
It not only elongates and changes its shape based on the angle like the Phong does,
but the Blinn shader respects this Fresnel phenomenon to the extent that the highlight
will increase based on the bending of the light, which is based on the angle of my eye ray.
So finally, I’m going to add a “Cook-Torrence” material here, and you can see that again
I’ve got the Ambience, Ambient, Diffuse and Specular – the Ambience and Ambient turned down to zero,
if I turn the specular down to zero I’m going to see the same phenomenon I saw with the Phong and the Blinn –
it’s based on Lambert’s Cosine Law, and it spreads evenly regardless of my camera angle –
it’s based on the angle of the light. However, with the specular highlight,
notice that the specular divides the index of refraction into three different channels,
so I have a red, a green, and a blue index of refraction and those indices will then change the color of the specular highlight.
Again, it respects this Fresnel phenomenon so that when I’m at a glancing angle I get a higher specular highlight,
and when I’m at a more direct angle I get very little in the way of a highlight.
If I change the way these light rays bend – right now I have my red index is 4, my green is 80, and my blue is 8;
so if I bring this down to like, 6, it will bias a little more towards blue – and if I make this red something like 20
it will bias that Index a little more towards the red.
One of the things that happens here is something called “Chromatic Aberration” and
what that will do is change the color of the highlight around the edge.
So of the three shaders, the Phong is the least physically accurate – it’s designed more for hardware render,
it’s made to quickly simulate shiny surfaces using hardware acceleration, open GL,
it’s not really very realistic.
The Blinn is getting there, it is an angle-dependent shader so it will change
dynamically as your camera angle moves, or as your point of view moves,
but the Cook-Torrence shader is probably the most physically accurate of the three.