Ambient occlusion refers to the blocking of indirect or diffuse light on an object. It refers to the darker areas of the object, typically creases, cracks and crevices. Ambient occlusion is caused by indirect light's inability to bounce around and illuminate areas that are blocked by a nearby object that absorbs the light rays. These subtle variations in lighting are visual clues for our eyes to detect surface details and distinctions that would otherwise be washed out and unnoticeable. Ambient occlusion adds realism to your scene by adding shadows in crevices, nooks and crannies, and so on. For each surface point, it calculates how much light is blocked by other geometry.
In the example below, the ice blocks stand out because of the shadowing between them. The cracks between the ice bricks appear darker because the light is blocked by the ice bricks. This is ambient occlusion.
Applications of ambient occlusion
Sometimes the lighting in your scene may be too bright, thereby washing out surface details. Ambient occlusion emulates the shadows produced by an overcast sky — it brings out cracks and crevices while keeping the lighting soft throughout the scene. Use ambient occlusion if your scene contains a lot of occluded crevices or if you want to add soft shadows to your scene.
For example, a sample application of ambient occlusion is to create a pass for compositing.
Incorporating ambient occlusion in your scene
You can calculate ambient occlusion using the following methods:
Both the mib_fg_occlusion and mib_amb_occlusion algorithms treat semi-transparent objects as if they were opaque. Occlusion rays do not penetrate through these objects.
Calculating occlusion using the mib_fg_occlusion shader is different from using final gather directly. In the former case, bouncing of light does not actually occur. The mib_fg_occlusion shader algorithm simply uses precomputed final gather points for emitting rays as well as the smoothing and filtering algorithms of final gather.
Baking occlusion in mental ray for Maya
To bake occlusion in mental ray for Maya, select Lighting/shading > Batch Bake (mental ray). Select Occlusion under Color Mode in the Texture (or Vertices) Bake Set Override section.
For more information regarding the batch bake option, see Lighting/shading > Batch Bake (mental ray).
Create occlusion files for external compositing
You can run an occlusion pass which renders ambient occlusion only. This can be used as your contact shadow pass. See Work with layer presets for more information.