Rendering Ambient Occlusion Passes in Maya

Almost all renders include an ambient occlusion (AO) pass that's composited with the beauty pass. The AO pass creates the deep shadows you find between cracks and seams and helps to create a more realistic render. However, there are also times when having just an ambient occlusion render for your scene is a great way to showcase your model, whether for your demo reel or just for fun. If you want to learn more about Ambient Occlusion and how it works be sure to check out Understanding Ambient Occlusion. This article will walk you through the process of properly setting up an ambient occlusion render for your model or scene in Maya, as well as cover some time saving techniques that will have you creating great looking AO renders in a short amount of time. So why would you want an ambient occlusion render for your demo reel or anything else for that matter? Well, there are a few benefits to it and a couple reasons why you should see the AO render as more than just a type of shadow pass for your final render. Ambient occlusion is a great way to showcase a model that doesn't have any textures created for it. If you're a modeler that just focuses on modeling or you have a few pieces that didn't get the texture treatment yet then AO can add that nice touch to your model to increase appeal. It's also a great thing to incorporate to a wireframe render because it helps the model stand out while still keeping the focus on the topology and not the textures. Whatever the case may be, whether you want to include an AO pass for your render or you want the AO to stand on its own, these methods will help get the job done.

Fast AO Render

This first method for rendering out ambient occlusion takes the shortest amount of time to set up because it utilizes the occlusion preset in Maya. It doesn't require much setup time but it does take the longest amount of render time. The first thing you'll need to do is select everything you want to have the ambient occlusion material applied to in your scene and then create a new render layer from selection. ao_1 With the new render layer selected go into the attribute editor and find the layer 1 node. ao_2 Now select the Presets button and choose occlusion. You should see that your model(s) are now completely black. No need to panic! This is just how the material looks in the viewport. ao_3 The occlusion preset automatically applies an occlusion shader onto all the objects you had in the new render layer with the default settings. ao_4 If you run a render you should see similar results as the image below, depending on your scene size. Let's make some adjustments to the material so the results look more in line with what you'd expect from an AO render. ao_5 Select any of the objects in your scene and find the surfaceShader node in the attribute editor. ao_6 With the surfaceShader opened select the go to input connection. ao_7 This will open up the mib_amb_occlusion material that was applied to all the models in your scene. For this example, the max distance doesn't need to be increased. However, depending on your scene you may need to play around with the max distance to get brighter results. The samples have also been increased to 256 to help smooth out the shadows. ao_8 There you go! In just a few minutes you've created an ambient occlusion render for your model by using the preset in Maya. Let's look at another method for setting up AO that takes a bit longer, but gives you much more control. ao_9

Rendering AO with mib_fast_occlusion

This method takes longer to set up but gives you more flexibility and depending on the settings can be rendered out much faster than using the Maya occlusion preset. Just like before, select your model and create a new render layer from selection. ao_fast01 Now go into the Hypershade by going to Window>Rendering Editors>Hypershade. ao_fast02 Under the material section of the Hypershade, select the Maya materials and drop in the Surface Shader into the Work Area. ao_fast03 Now go under the mental ray materials and select Textures and drop in the mib_fast_occlusion shader into the Work Area. To plug the occlusion shader into the Surface Shader simply MMB click and drag onto the Surface Shader and select Default. ao_fast04 Select your model and right click the Surface Shader in the Hypershade and choose Assign Material to Selection. ao_fast05 The mib_fast_occlusion shader works by using the ambient occlusion feature in the mental ray render settings. So go to the render settings and make sure you're rendering with mental ray and under the Indirect Lighting tab scroll all the way down to Ambient Occlusion and turn it on. ao_fast06 If you run a render you should see similar results, depending on your scene size. Under the mental ray ambient occlusion settings you should see the rays option which by default is set to 256. These rays are the same as the samples in the mib_fast_occlusion node. ao_fast07 However, if you notice in the mib_fast_occlusion node the samples are set to zero by default. That's because the sharpness of the render is determined by the rays within the mental ray settings. The rays act as the global setting for any mib_fast_occlusion shader in the scene. If you change the number to anything besides zero in the mib_fast_occlusion node it will override the rays in the mental ray settings for that particular node. ao_fast08 If you increase the rays it will produce smoother results. It's important to keep in mind that the higher the rays are will mean much longer render times. Right now the render time is about one minute, which isn't very long. However, with the mib_fast_occlusion shader you can get much faster render times. ao_fast04 Within the ambient occlusion settings in the Indirect Lighting tab of the mental ray render settings turn on Caching. Under Cache Density you should see by default its set to 1. Try knocking this number down to around .8. You should start to see much faster render times. In this example it knocked down the render time from 1:07 to just 12 seconds. ao_fast10 Now the biggest downside to this is that the results may not be as crisp, however you should be able to play around with this setting to find a happy medium between fast render times and satisfactory results. Rendering an ambient occlusion pass can be done quickly and provide great results for your final render or a be part of a demo reel breakdown, how you decide to use it is up to you. If you want to learn more about rendering in Maya be sure to check out our hundreds of rendering tutorials.