Professional Documents
Culture Documents
The goal of this short tutorial is to introduce a few select aspects of mental ray so that you may
consider incorporating them in your projects if appropriate. These include global illumination and
ambient occlusion. Well focus on the key attributes that are useful in optimizing each, and use
different scenes to simplify and facilitate the demonstration of each effect. Well also explore
another feature of mental ray the approximation editor that is unrelated to lighting.
Global Illumination
Global illumination (GI) is a method of indirect lighting photons are emitted from one or several
light sources and are bounced around your scene. As they hit surfaces with a diffuse light
component to their shader, they bounce off that surface and in the process accumulate color as
well (i.e. color bleeding). Objects that bounce photons become secondary light sources in
themselves. The following simple example shows you how to enable GI in a Maya scene and, in
particular, how to optimize GI settings to achieve a smooth lighting result.
Geometry set-up
To demonstrate the GI effect, well model a
simple forked tube that has a spotlight inside
one of its side branches. The main trunk of the
tube will have no lights and will therefore only be
lit from the spotlight emanating from this side
tube. Without GI, the spotlight will cast a single
area of light inside the tube with GI enabled,
however, photons emitted from the spotlight will
hit the wall of the tube and then continue to
bounce thereby extending the area of
illumination inside the tube. This basic set-up
will help to exaggerate GIs contribution to
lighting in a scene (an effect that can otherwise
be very subtle).
Scaled cube.
Approximation Editor
Before we set-up GI lighting lets take quick look
at mental rays approximation editor. This
allows you to override Mayas tessellation for
objects with instructions derived from mental
ray. The powerful thing about this method is that
it all happens at render time - so there is no
need to use a higher poly-count version of your
model or to convert it to a subD model.
To open the approximation editor, go to Window Approximation Editor: finding it (above) & the options window (below)
-> Rendering Editors -> mental ray ->
Approximation Editor. The window that opens
gives you a few choices depending on the type
of geometry you want to add a surface
approximation to. For our purposes, select your
polygonal object and click on the Create button
that is in the second panel labeled Subdivisions
(Polygon and Subdiv. Surfaces). Nothing seems
to happen other than the Create button
becomes grayed out. If you look through your
Finding the Approximation Editor
advTutorial 7: mental ray
Gal McGill
Optimized GI
Ambient Occlusion
Ambient occlusion is another technique that
improves realism in your renders it calculates
the degree of occlusion between objects and
darkens this region based on the distance
between the objects. Unlike the GI process that
adds light to the scene by emitting GI photons
from light sources (and these photons bounce
around picking up color information as they go),
ambient occlusion does not take into
consideration any lighting information only the
proximity of objects to one another. It works by
darkening these areas and thereby adds realism
by removing light from the scene. There are
several ways to get ambient occlusion into your
renders either as part of a color pass (i.e.
where the ambient occlusion shader is part of a Default render of the handheld scene
shading network that also takes lights and color
into consideration) or as a separate pass
generated from a render layer/pass preset. We
will begin with the latter.
Open the handheld.ma file that is provided along
with this tutorial. Youll notice a device (initially
modeled as a polygon and then converted to a
subdivision surface) that is sitting a flat surface
(the benchtop). It is also broken into pieces to
facilitate applying different shaders in this
exercise (see the Outliner). Take a render from
the RENDERCAM to see what the default scene
Creating a new render layer and applying the occlusion preset
looks like.
To take advantage of mental rays out-of-thebox occlusion preset, select all the objects in
the scene using the Outliner and go to the
render layers section of the channel box column
click on the right-most icon (the one with the
little blur ball sitting atop a grey layer). This will
automatically create a new render layer for you
and automatically add all the selected geometry
to it. Notice that a default masterLayer is also
created for you this contains all of the objects
in your scene with their normal or existing
lighting shading information. Double click on the
new layer (labeled layer 1) and rename it to
occlusion.
Maya 2009 has a whole new system for setting
up and managing render layers and render
passes. Once you have created a new render
layer with the desired objects in it and renamed
it, open the Render Settings and make sure that
this new layer is selected (at the very top of the
Render Settings window, should say Render
With the pass set-up completed, you should have the AO pass
in the Associated Passes section of the Render Settings.