Rendering Ambient Occlusion (AO)
is a key component in your final render and is often part of the many rendering passes. Not only is it great to use in conjunction with other rendering passes but it also looks pretty great by itself and can often be used to represent a model's wireframe. Rendering ambient occlusion is a vital technique to master because it can serve many different purposes. Whatever you decide to use it for, you'll learn step-by-step the different methods for setting up an AO pass in this article.
If you want to learn more about Ambient Occlusion and how it works be sure to check out Understanding Ambient Occlusion
Rendering AO with a Shader
As with most other 3D
applications you can setup an ambient occlusion pass through a shader, so let's walk through that method first as it's probably the easiest of the two.
The first thing you'll need to do is open up the Material Editor in 3ds Max. So go up to Rendering>Material Editor>Compact Material Editor.
This ambient occlusion is going to be applied as a map to a new material. So select one of the default materials and scroll down to the Basic Parameters. For this you can plug it in to the Self-Illumination color. Now, you could map it to the diffuse color but mapping it to the Self-Illumination ensures it receives no direct illumination. Go ahead and check the Color box and select the box next to the Self-Illumination color. This will open up the Material Browser.
By default the only materials that are visible are the standard materials, which show the materials available to us based off the default render engine in 3ds Max. Since you'll be rendering through mental ray, select the drop down menu in the Material Browser and choose Show Incompatible.
This will show all the available materials. Scroll down until you find the mental ray materials and choose the Ambient/Reflective Occlusion material.
You may notice that the material hasn't changed appearance in the material editor, that's because you've plugged in a mental ray material. To fix this simply go to your render settings and scroll down until you find Assign Renderer and choose mental ray. Now you should see a completely white material.
You could simply drag this AO material directly onto your model, but if you're using this as a separate AO pass to composite onto the final render then you probably don't want to override the materials that are already on your object or scene. To avoid this you can temporarily apply a material override to objects in your scene by changing the render settings. So open up your Render Setup and under the Processing tab check the Enable box under Material Override. Now select the "None" button.
This opens up the Material Browser again. Scroll down toward the bottom until you find Sample Slots. Choose the Ambient Occlusion shader you've created.
Now run a test render. You should see a decent looking ambient occlusion pass. However, it's probably not as smooth as it could be. So let's go back into the material editor.
Select the box next to the Color in the Self-Illumination parameters to open up the setting for the ambient occlusion shader.
One of the first things to adjust is the Samples. The higher the samples the smoother the results are going to be. For this the samples have been bumped up to 256. If you run another render you should see right away that the AO pass is much smoother. Of course, it increases render time so you might need to find a happy medium between fast render and good results.
If you find that you're getting pretty blown out results go back into your material by selecting the Go to Parent button and select the Diffuse color. You can darken this value, the darker this color the less blown out your AO pass is going to be. You can play around with the diffuse color until you get the results you want.
Not bad, right? You can take this AO pass and throw a wireframe on it for a breakdown in a demo reel or composite it onto the final render in a program like Photoshop
Rendering AO with Scanline Renderer
This next method is a little easier to setup than the first technique, but might not produce the most accurate or flexible results because it's done through the render settings. However, it's still a good way to render out an AO pass and depending on your workflow either technique will get the job done.
The first step is to open up your material editor and select one of the default materials.
Select the Diffuse color and change it to completely white. This will act as the AO material. Next select the objects in your scene and apply this new material.
Now select the Render Setup button to open up the render settings and navigate to the Advanced Lighting tab. You want to make sure you're using the Default Scanline Renderer for this method.
Open the dropdown menu in the Advanced Lighting tab and choose Light Tracer. You should now see the AO parameters displayed. Before doing any adjusting to these settings there's one more key element to this method in order to properly create an AO render and that's to drop in a light.
Go to Create>Lights>Standard Lights>Skylight and drop the skylight anywhere in the scene. The skylight will provide even illumination throughout the entire scene, which is what you want.
Now run a test render and see the fruits of your labor! You can go back into the render settings and adjust the Light Tracer attributes to fine-tune the AO results. One of the most important parameters to keep in mind is Global Multiplier which basically controls the brightness and the Rays/Samples.
If you find that the white material you created is a little dark you can open up the material editor and bump up the Self-Illumination color to brighten the color of the material.
You can see that this method is quite a bit faster and easier to setup but it doesn't give you as much flexibility because you have to render with the Default Scanline Renderer and the AO results are fine-tuned based on the render settings. You'll also need to hide any lights you have in your scene and setup just the skylight.
Either one of these methods is a great way to quickly render an AO pass for your models. While the first method gives you more control over the AO and is best used when compositing your AO pass, the second technique is faster to setup. For more great tutorials visit the Digital-Tutors library
to learn the entire 3D production pipeline with in-depth tutorials from the creative professionals who know the industry.