This tutorial will discuss Reflections and Highlights in the real
world, and how they're simulated in your CG scenes. It will also touch
on the topics of fresnel and IOR, rough vs smooth reflections, and
metallic and non metallic surfaces.
While I'll be using 3dsmax as my example software, the theory
applies to any commercially available 3d app
and renderer.
If you are a 3dsmax user, a few notes on renderers and materials:
3dsmax has a
number
of
available renderers, including the Scanline (the original renderer that
came bundled with max), mentalray, and then there's a
number of 3rd party renderers such as Vray. In the Scanline renderer,
your main two materials are the "Standard Material", which is an older
material that doesn't work particularly well with raytracing, and also
the "Raytrace Material" that gives you simple raytrace functionality
inside the scanline. Vray's "VrayMtl" and mentalray's "Arch And Design"
materials are more modern materials that have far more raytracing
controls. While you should use any renderer
you want, I'd recommend using Vray or mentalray as they have access to
more modern features such as Global Illumination and Glossy Raytrace
effects.
The 3 Kinds Of Reflected Light
So there are three basic types of reflected light in CG, Ambient, Diffuse and Specular. These names are short for Ambient Reflection, Diffuse Reflection and Specular Reflection.
Ambient Light, and Why To Turn It OffDiffuse Reflections
What is a Diffuse Reflection? Well, when light hits a surface, part
of the surface will scatter light back in a uniform manner, and that's
a
Diffuse Reflection. For most non-metal materials, it is the
primary color of your object. A popular shader for creating a diffuse
reflection is called a Lambert Shader.
Specular Reflections
What are Specular Reflections? When light hits a surface, part of the surface will scatter light back in a much more focused manner. Some great examples are your reflection in a mirror, or the glint of the sun on a metallic surface, or the shine on a plastic surface. A popular shader for creating a specular reflection is Blinn or Phong.
In old school computer graphics, a Specular Reflections is generally
broken up
into two parts, Highlights and Reflections. This terminology is
annoying, because when someone says
"Reflection", they generally mean "Specular Reflections", even though
there's Diffuse and Ambient Reflections as well. In the early days of
CG, because calculating Raytraced Reflections
were expensive, you tended to not have Reflections on a surface, and
instead you only had a Highlight, which was a cheat. These days, most
renderers do Reflections, and you don't need to use the highlight cheat
anymore.
The Truth About Highlights
So in the early days of CG, your Specular Reflections was Highlights only. You generally controlled the Highlight on your material using Specular controls, such as shininess strength and glossiness. And then as computers got faster, a second set of controls were added to give your material Raytraced Reflections. So now we had two sets of controls, one for your Highlight, and one for your Reflection. But in the real world, there is no difference between a Reflection and a Highlight. What we call a Highlight is just a Reflection of a light source on your surface. And in those early days, all light sources were what is known as a point source: the light is sent from an infinitely small point to the objects it illuminates. Real lights don't work this way, light is emitted from an area, such as your light bulb, and as such, real Highlights come in all sorts of shapes and sizes, most of which are not round (the Highlight produced by a point light source is generally round).
We get closer, and we see the Highlight isn't an oval shape, but a Reflection...
...of our light source overhead.
So while cg used to be all about Highlights and point light sources
(because calculating the real thing would be too slow), for the most
part
these days, it's now about true Reflections and area
lights. So you turn on the Specularity of your material, and you will
get both a Highlight (Reflection of point lights) AND a Reflection
(Reflection of all the objects in your scene, including area lights).
No more two separate controls, one control that controls both equally.
Additive vs Default Reflections
Different materials in your cg software provide either Additive
reflections, proper
Energy Conservation based reflections, or both. For example, the
Raytrace Material in 3dsmax has two reflection modes in extended
parameters. These two
modes
are Additive and Default. The 3dsmax Standard Material uses Additive
and
cannot
be changed, the Raytrace Material gives you the option, and defaults to
Default. What's the difference? The difference is that Default follows
the laws of Energy Conservation, and Additive does not.
For more info on Energy Conservation, please read Energy Conservation In Shaders.
Look at this image...
The material to the left is a 3dsmax Scanline Renderer Raytrace Material using Additive mode, the material on the right uses Default mode. So based on what we learned about Energy Conservation, the left sphere that mixes a strong Specular Reflection with a high amount of Diffuse illumination (the blue of the ball) is not a natural phenomenon. This is a good reason (IMO) to not use the Standard Material, and instead use a more advanced material like the Raytrace Material in 3dsmax's Scanline Renderer, the Arch & Design Material in mentalray, or the VrayMtl in vray, as they follow Energy Conservation. Or if you do want to use the Standard Material, remember to reduce the brightness of your diffuse if you're going to increase the specular reflection to avoid the over bright sphere in the example above. Fresnel and IORNow that we've done away with the Specular Highlight cheat, and replaced the cheat with a true Reflection of your scene and light sources, we can move on to how these Reflections appear on different materials. This brings us to the concept of Fresnel and IOR. Materials are assigned an IOR based on how they reflect light (IOR stands for Index Of Refraction, but even non refractive objects such as metals have an IOR, usually referred to as a "complex IOR". A complex IOR measures a slightly different property then a regular IOR, but it deals with the same stuff, light reflecting or refracting off / through a surface). As a surface starts facing away from the viewer, it reflects more then a surface that is directly facing a viewer.
Here's a reflective glass surface. Notice how it's less reflective when I look directly at it from the front vs looking at it from a side angle. The greater the angle the more it reflects.
On round surface like a sphere (as opposed to a flat surface like
the glass),
this means the edges of the sphere will reflect more Specular light
then the
front of the sphere. This phenomenon is called Fresnel.
Here's another example, as we see more of the leaf's side angle, it reflects more of the sun...
Different renderers have different ways to do Fresnel. In 3dsmax's
Scanline Renderer, it's simulated using the falloff map in
the Reflection slot
of the Raytrace material. Place a falloff map in your reflection slot,
and set it to fresnel. Uncheck override IOR, and return to the top
level
of your material, there's an IOR setting there. In Vray, Fresnel is a
checkbox on the material itself, with an IOR ready for setting.
Different types of real world materials have different IORs, some good example are air is 1.0, glass has an IOR of about 1.5, plastic between 1.1 and 2.0, gloss materials such as porcelain or car paint 3-5, super shiny metals like chrome a value of 10-20. The IOR controls the proportion between how much the faces pointing away from your reflect vs the faces pointing towards you. For example, a lower IOR means that the away faces will reflect a lot, and the faces facing your reflect very little, and a higher IOR will make just about all faces of your object reflect the scene the same amount.
Metals vs Non Metals
So the main difference between metals and non metals are...3dsmax Scanline's Metal Shader
3dsmax's Standard Material comes with a shader called "metal", and if you play with it, you'll notice it seems to follow the laws of energy conservation, in that the more specular highlight, the less the diffuse color affects the surface, and the more diffuse the object is, the less the specular highlight. Unfortunately, this shader is overly simplistic, and does not actually follow the real science behind the Diffuse / Specular relationship. That is one of the reasons I'd suggest avoiding the metal shader, a little knowledge and good observation on your part will allow you to simulate this Diffuse / Specular relationship without being stifled by a shader type that is inaccurate. Read more about it in my Chrome Material lesson. The way to achieve a more accurate and flexible shader is by simply changing the shader to blinn or phong, and then changing the Diffuse color to almost black. That way, a high IOR will apply a bright clear reflection, and reflect almost no Diffuse light since your Diffuse color is almost black. The advantage of this method is that if you need to add a little Diffuse color to your object to get it to light properly, you can, and without reducing the reflective qualities of the surface. Just remember that the shinier the metal, generally the closer your diffuse color should be to black, and vice versa, and observe real world examples to help you find the right balance.Following these rules means ideal materials can be made quite simply. For example, chrome is just a Raytrace Material with fresnel in the reflection slot, an IOR of 10-20, a black ambient and diffuse color, and remember, no specular highlight (since specular is now a reflection of your environment). Worn chrome can be simulated by applying a bump map to this material.
Colored Metals like Gold
Another thing to consider is colored metals (like gold). As mentioned above, metals can tint the color of their Specular Reflections. So since gold is more yellowish in color, its Specular Reflections take on a yellowish tint.
Here's an example, a set of keys and a blue pen. Notice how the grey key reflects the true color of the pen top, and the golden key tints the highlight and pen color the key color. Also note the reflection of the keys in the pen top, which is plastic. Although on first glance it may seem like the reflections are tinted blue, it's actually just the blue diffuse showing through the weaker reflection (remember, as stated above, non metals don't tint their reflection). The pen top probably has an IOR of somewhere between 2 and 3, the keys are closer to 10, but the reflections are broken up a bit since the keys are all scratched up.
Here's another example, 4 colored pencils reflected in colored metal. Notice how all the colors are tinted gold, with the white pencil appears the most tinted.
Again, how do we do this in our 3dsmax materials? This is achieved
by
tinting
the color of your reflection. And the way you do this depends on what
material you're using. In the Standard and Raytraced Materials, the
reflection
color
in the falloff map is changed to a golden color. In Vray, the Reflect
color should be a golden color.
By doing so, the colors of the balls being reflected change to approx. the same colors we saw in our real world photograph.
Note that since the ball is in a completely white environment, and
its
IOR is so high (ie, it reflects pretty uniformly over the entire
surface
of the sphere) the sphere is almost entirely gold. If you replaced the
white environment with say a room, and it were a completely raytraced
image,
this would look natural since it would be properly reflecting
everything
in the environment. However, if you're integrating this material into a
scene with no raytracing (but possibly a reflected environment map) you
may wish to place the falloff map inside of a second falloff map set to
shadow light, with the fresnel falloff map placed in the light part of
your shadow/light falloff, and the color black in the shadow slot. This
will stop the material from glowing where it receives no illumination
from
a standard max light source in scenes where you're mixing reflections
and
more traditional point light sources.
But again, in general, I
recommend using only area lights and real raytraced reflections
nowdays, then
you don't have to worry about these older cheats.
How Glossiness Affects How
Reflective An Objects Is
Reference
Hopefully you find something in here that can help you better understand how reflections in the real world work, and how to simulate them in 3d. For my parting words, I can't recommend enough good reference for whatever you're doing, in preparing for this tutorial, I really had no idea for example how the reflections on a colored surface should look. Finding the golden object, taking some good reference photos, this told me how things should look, and after playing in 3d, I was able to figure out how to simulate that look in 3d. Just playing in 3d without reference till I got something that I thought looked right would have taken me a lot longer, and probably would have returned incorrect results, trust your eyes, research before you pick up that mouse and start texturing. It'll save you a lot of work.