Ambient Occlusion (AO) is the lighting caused when a scene is surrounded by a uniform diffuse spherical light source. Think of the scene as being surrounded by a humongous sphere that uniformly emits light from its surface. AO captures the low frequency lighting. It does not capture sharp shadows or Diffuse or Specular lighting. So, AO is usually combined with Diffuse and Specular lighting to create a full lighting solution.
The Ambient Occlusion node generates global lighting effects in 3D-rendered scenes as a post effect. It quickly approximates computationally expensive ray-traced global illumination. Being a post effect, it exposes similar aliasing issues like the Shader, Texture, and Volume Fog nodes. Hence, artifacts may appear in certain situations.
The AO node rarely works out of the box, and requires some tweaking. The setup process involves adjusting the Kernel Radius and Number Of Samples to get the desired affect.
The Kernel Radius depends on the natural “scale” of the scene. Initially, there might appear to be no AO at all. In most cases, the Kernel Radius is too small or too big, and working values must be found.
Ambient Occlusion Node Inputs
There are three inputs on the AO node. The standard effect mask is used to limit the AO effect. The Input and Camera connections are required. If either of these is not supplied, the node does not render an image on output.
- Input: This orange input accepts a 2D RGBA image, Z-Depth, and Normals.
- Camera: The green camera input can take either a 3D Scene or a 3D Camera that rendered the 2D image.
- Effect Mask: The optional blue effect mask input accepts a mask shape created by polylines, basic primitive shapes, paint strokes, or bitmaps from other tools. Connecting a mask to this input limits the Ambient Occlusion to only those pixels within the mask. An effects mask is applied to the tool after the tool is processed.
Ambient Occlusion Node Setup
The Ambient Occlusion node is typically placed after a Renderer 3D node. The Renderer 3D node must have Z-Depth and Normals enabled in its output channels. The Camera3D that is rendered by the Renderer3D node is then connected to the camera input on the AO node.
Ambient Occlusion Node Controls Tab
The controls tab includes all the main controls for compositing with AO. It controls the quality and appearance of the effect.
- Output Mode
- Color: Using the Color menu option combines the incoming image with Ambient Occlusion applied.
- AO: This option outputs the pure Ambient Occlusion as a grayscale image. White corresponds to regions in the image that should be bright, while black correspond to regions that should be darker. This allows you to create a lighting equation by combining separate ambient/diffuse/specular passes. Having the AO as a separate buffer allows creative freedom to combine the passes in various ways.
- Kernal Type
To determine the AO, rays are cast from a point on the surface being shaded, outward to a large enclosed sphere.
The AO factor is determined by the unoccluded rays that reach the sphere.
- Hemisphere: Rays are cast toward a hemisphere oriented to the surfaces normal. This option is more realistic than Sphere and should be used unless there is a good reason otherwise. Flat surfaces receive 100% ambient intensity, while other parts are darkened.
- Sphere: Rays are cast toward a sphere centered about the point being shaded. This option is provided to produce a stylistic effect. Flat surfaces receive 50% ambient intensity, while other parts are made darker or brighter
- Number of Samples
Increase the samples until artifacts in the AO pass disappear. Higher values can generate better results but also increase render time.
- Kernel Radius
The Kernel Radius controls the size of the filter kernel in 3D space. For each pixel, it controls how far one searches in 3D space for occluders. The Filter Kernel should be adjusted manually for each individual scene.
If made too small, nearby occluders can be missed. If made too large, the quality of the AO decreases and the samples must be increased dramatically to get the quality back.
This value is dependent on the scene Z-depth. That means with huge Z values in the scene, the kernel size must be large as well. With tiny Z values, a small kernel size like 0.1 should be sufficient.
You can use the lift, gamma, and tint controls to adjust the AO for artistic effects.
Ambient Occlusion Node Settings Tab
The Settings tab in the Inspector is also duplicated in other Deep Pixel nodes. These common controls are described in detail HERE.
About the Author
Justin Robinson is a Certified DaVinci Resolve, Fusion & Fairlight instructor who is known for simplifying concepts and techniques for anyone looking to learn any aspect of the video post-production workflow. Justin is the founder of JayAreTV, a training and premade asset website offering affordable and accessible video post-production education. You can follow Justin on Twitter at @JayAreTV YouTube at JayAreTV or Facebook at MrJayAreTV