![]()
Ambient occlusion concepts
Definition of occlusion
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:
- Using the mib_amb_occlusion shader. A number of probe rays are traced inside the hemispherical area above each point, and the probe rays determine the extent to which the area is blocked by other geometry in your scene.
- Using the mib_fg_occlusion shader. Rays are emitted from special final gather points created during the precomputation phase. By contrast, rays are emitted from the shading point when using the mib_amb_occlusion shader.
- Using the Transfer Map tool. Generate an ambient occlusion map from a high resolution object and then bake that map to the mesh of a low resolution object using the Transfer Map tool. This allows the low resolution object to appear to have ambient occlusion detail. For more information regarding the Transfer Map tool, see Transfer Maps.
Baking occlusion in mental ray for Maya
To bake occlusion in mental ray for Maya, select Lighting/Shading > Batch Bake. 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 of the Rendering guide for more information.