3DS
Max 7: MentalRay: Ambient Occlusion
Using Ambient Occlusion to enhance render details
|
|
Description
and usage of the Ambient Occlusion Shader
There are many uses for the Ambient Occlusion shader, one being
to accentuate details/edges and increase the realism of 3d renders.
This occlusion is also known as the 'dirtpass' or 'dirtmap'. The
pass renders quite quickly and since it is a Global Illumination
(GI) solution, it is an excellent tool when time is of the essence,
and GI quality is required.
I
will not go into the details of the science behind the magic, simply
put; ambient occlusion fires rays into the scene at various angles
from various points on the geometry, and determines which rays are
blocked by other geometry, and creates a visual representation of
the occlusion. The closer the occlusion, the stronger the representation.
Below are 3 spheres over a plane. You can see the strength of the
occlusion is dependant on the distance to the plane. If you look
closely, you can see the spheres also are 'casting' occlusion upon
each other.

Overview:
We
will render our image normally, and save the result. This can be
done using any renderer, default scanline, radiosity, mentalray
etc. Next we will assign all the objects in our scene the occlusion
shader. We will composite the two resultant renders in a third party
application. In this instance, since it is just a still, we will
use Photoshop. Any video editing package will allow you to composite
them for animation as well.
 |
 |
| Scanline
Render |
Ambient
Occlusion Pass |
Step 1: Render Scene
There is no need for any preparation, simply render your
scene as you normally would. In this instance I created a simple
greeble wave, rendered with default lighting.

| Step
2: Assign MentalRay as your renderer. |
|
|
Step
3: Create a MentalRay Material. |
 |
|
|
 |
| Step
3: Click None in the surface
parameter slot, and select Ambient/Reflective Occlusion to create
the base shader. |
|
|
Step
4: You now have your base 'dirtmap' shader. Read on for
an explanation of the base parameters relevant to our cause. |
 |
|
|
 |
 |
Samples: determines the quality of the solution,
the more the better. Tradeoff is rendertime.
Bright/Dark: sets the colors for the extremes
of the shader. For our purposes, we will leave the defaults
of black and white.
Spread: this value sets the level of diffusion
of the occlusion. If the default value leaves your render
'loose' you may reduce this value to 'tighten' the solution.
Similar to the level of a Gaussian Blur filter in Photoshop.
Type: again, we leave this at default, 0,
which is occlusion.
|
|
|
Step
5: Assign the shader to all your scene objects. One
sweet way to accomplish this is by using mental rays Material
Override. Under the processing tab dwells the Material Override
slot. Drag your material from the editor, or select it by
clicking the Material Override slot, and selecting it from
the editor.
The
benefits of this technique are that you do not have to edit
your scene materials, simply toggle Enable, and that shader
overrides all the objects in the scene.
"Captain!!! I canna control the materials!!"
"INITIATE MATERIAL OVERRIDE!!!!"
|
|
Step 6: Set your environment
background to white.
Depending on your scene specific/quality needs, you may want
to raise the Samples per Pixel in the Render Scene dialog.
Render
the image.
|

Step
7: Composite
In Photoshop, copy the Occluded image and paste it
on a layer over the Diffuse pass. Set the Occlusion layer to
Multiply. Adjust the opacity as you see fit. Click save. Dance
a jig. |
|
This
is just one use for this most excellent shader, you may
add it to other material slots as well as incorporate it
into your lights. It is fast, simulates Global Illumination
and is highly customizable. Have fun!
Read
on for further options and other uses for this most excellent
shader.
Next
Page: Using displacement with the shader
|
Updated
5.13.05
|