In addition to the below content, see also: Corona AO Shader at Chaos Docs
For maximum realism and physical accuracy, we do not recommend using ambient occlusion to enhance shading. Corona Renderer will take care of darkening concave areas without any special tweaks, as that would be also expected in real life. Ambient occlusion can be however used to create advanced materials, such as rusted metal, worn wood, scratched paint, etc, or to provide "artistic" control over the overall scene's appearance.
1. How to enable the ambient occlusion effect for a specific material? (dirt, "worn off" effect)
To add dirt or "worn off" effect to your material, simply use Corona AO shader for this:
The Corona AO shader can be used for some advanced effects. For example, Oxidized brass.
It can also be used as a mask to blend two or more materials - in the example below, paint worn metal:
Click to enlarge
Click to enlarge
Corona AO settings
Occluded/Unoccluded Color & AO Distance
There are three inputs for Corona AO, the first two control the occluded and unoccluded color which can also be controlled with a texture. The third input controls the distance parameter of Corona AO through the use of a texture or a bitmap, which can additionally be controlled using the Max Distance parameter. The following examples showcase how occlusion is applied depending on the Max Distance. Low values provide contact shadowing and amplify possible cavities on the mesh by also being faster to render, while higher values cover larger surfaces/areas but also render slower.
Max distance: 1cm, 10cm, 100cm
Calculation mode & Color spread
There are three different methods of controlling how occlusion is calculated:
- The "Outside" mode is enabled by default and it creates occlusion by looking at the object from its outside (front-facing surface). This is similar to illuminating an object with environmental lighting.
- The "Inside" mode will consider occlusion looking from the inside of the object (back-facing surface).
- The "Outside + Inside" mode calculates both other modes at once and merges them.
Calculation mode: Outside, Inside, Both (Outside & Inside)
In the following example, a texture map is being used as occlusion color, with the help of Color Spread the occluded color can replace the unoccluded one by increasing the amount from 0% to 100%. This makes the effect of occlusion stronger and more apparent.
Color spread : 1%, 100%
Usually, there is no need to change the default value. Increasing the number of Samples will provide a cleaner render (less noise) in a shorter time at the cost of other effects such as GI and anti-aliasing. Lower values render faster but look noisier.
Low values of this parameter result in uniform ray distribution around the geometry normals. Increasing this value causes the rays to focus on the occluded areas only. The following example showcases how ray concentration changes while Ray Directionality goes from 100% to the default 0%.
Ray Directionality: 0% (Default), 100%
Direction offsets can also be used for the X, Y, and Z axes separately. This is useful when you only need the effect in a certain direction.
Direction Offset: X-Axis 10.0, Y-Axis 10.0, Z-Axis 10.0
2. How to add a global ambient occlusion pass for further post-processing?
To enable a pass that can be used to add ambient occlusion to the whole image globally:
1. Go to Corona > Multi-Pass:
2. Add a Texmap pass, and then select Corona > AO as the map:
3. This will result in having the Texmap pass available in the Picture Viewer apart from the Background pass:
4. The two passes can be then blended together within the Picture Viewer to preview the effect: