Realistic Reflections - Fresnel and HDRI

by Novakog

Part I - Fresnel

First off, this tutorial requires that you know basic shading in Maya, working with shading networks, etc. It also only applies to Maya 4.5 and up because it makes use of Mental Ray (unless you have Mental Ray for a lower version).

Now, to start out, I have a simple scene of a reflective sphere (with a mapped reflection) and a plane with a final gather dome (if you don't have a final gather dome, or don't know what it is, it doesn't matter, it's just for the sake of a nice render).

This doesn't look very good, does it? The first thing we're going to add is Fresnel reflection, or the Fresnel Effect, named after Augustin-Jean Fresnel (who also invented the Fresnel lens). The Fresnel Effect is the effect that as your viewing angle to the surface gets closer to zero degrees (or incidence angle gets closer to 90 degrees), the surface becomes more reflective.

To further demonstrate the effect, I will show you a picture of a car, in which the Fresnel Effect can be seen best. If you want, you can skip ahead to where we actually do Maya stuff, but being able to observe things like this in reality is important to understand why it makes your car more realistic. This picture is taken from the Ferrari website (ferrari.com) btw.

Look at the edges of the car, notice how it becomes more blue/purplish. That's because at the edges the viewing angle is closer to zero and therefore the surface is more reflective. That should be a good demonstration of how important the fresnel effect is.

Finally, to the actual creation of it in Maya. Open up hypershade, and create a ramp where the bottom of the ramp is white and the top is a medium darkish gray, like so.

Next, create a sampler info utility and MMB drag it on to the ramp, and select Other.

This will open up the connection editor, which is also seen in my terrain tutorial. In the connection editor, on the left side (for the sampler info) click "Facing Ratio". On the right side, expand the "Uv Coord" section of the ramp attributes (by pressing the plus sign, obviously) and select "V Coord".  Both will now be highlighted, like so.

The facing ratio is the viewing angle of the camera, and the V Coord is the vertical (V doesn't stand for vertical as far as I know, it's just a coincidence) coordinate/"position" of the ramp. So what happens is as the view angle of the camera gets smaller (as the facing ratio does), the position of the ramp it will use for reflectivity (when we connect it) will be lower, and therefore closer to white (or 1.00, which is 100% reflectivity).

Finally, all we have to do it MMB drag the ramp on to our shader and hit Other to open up the connection editor again. Link the ramp's Out Alpha to the Reflectivity of our shader. That's it for fresnel, now let's run a test render.

Oooh, look at those soft reflections.

Next: HDRI Enviroment Maps