Ambient Occlusion

Table Of Contents


Introduction

Ambient Occlusion (AO) is a shading technique that was developed back in the time when global illumination was impractical. Instead of shooting many rays and bouncing them around (which is what is needed for global illumination), ambient occlusion was used to detect the parts of the scene that are occluded from the rest of the environment (such as corners and creases).

Today's computers are much more powerful than when Ambient Occlusion was first developed and the use of global illumination is now the norm. This reduces the usefulness of ambient occlusion as a primary lighting technique. However, Ambient Occlusion to achieve different effects such as:

Redshift allows the results of the Ambient Occlusion node to be connected and combined with other rendering techniques which provides the user with a very good degree of flexibility.


If you need to create a full-scene Ambient Occlusion render pass please take a look into creating and using a Custom AOV pass.


Parameters



In the examples below the ambient occlusion's out color has been connected to an incandescent shader's color input in order to preview the result.


Samples

Ambient occlusion is a multi-sampled technique, which means that it uses several samples (rays) per pixel. Often times a fairly clean result can be obtain with relatively few samples. Of course, if the Ambient Occlusion node is used to drive other shading nodes that might be of very high contrast, more samples might be needed.


Samples: 4

128


Bright / Dark Color

The result of the ambient occlusion node is a color. These two parameters define the darkest possible color (i.e. when the pixel is completely occluded) and the brightest possible color (when the pixel is totally unoccluded). By default the bright color is set to white and the dark color is set to black. 


Bright color: White

Dark color: Black

Red

Blue


Spread

Ambient occlusion works by shooting a number of rays for each pixel. These rays are shot in a hemispherical fashion which produces a smoothly spread out result. The spread parameter makes the rays more concentrated around the pixel's normal which allows the AO effect to be 'tightened'. The lower this value is, the tighter the AO effect. Please note AO Max Distance has been set to 1 for the examples below.


Spread: 0.0

Max Distance: 1.0

0.1

0.5

1.0



Falloff

This allows you to control the tightness of the transition between occluded and un-occluded areas, with values less than 1.0 biasing towards un-occluded and values greater than 1.0 toward occluded.


Falloff: 0.0

0.1

1.0

3.0


Maximum Distance

This defines the maximum length of each one of the AO rays. The larger the length, the more areas will be considered 'occluded' and vice-versa.


A length of 0.0 will use the maximum scene ray distance.


Please note that, in the following scene, the model is approximately 2 units tall.


Maximum Distance: 0.0

0.05

0.5

3.0


Reflective

Normally, AO behaves as a 'diffuse' effect. However, there are some (rare) cases where a user might prefer for AO to behave more like a glossy reflection. This option enables that mode. This can be useful if you are combining AO with environment shaders (using the "Sampled Environment" output mode explained below) and you  only want to show the environment in the reflections. The "Spread" parameter controls how glossy these fake reflections are.


Reflective: Disabled

Spread: 1.0

Enabled

1.0

Enabled

0.1


Invert Normal

This option allows you to reverse the occlusion effect, whereby open corners will now receive the occlusion.


Invert Normal: Disabled

Max Distance: 1.0

Enabled



Output Mode

The Ambient Occlusion node can output data in several different methods:


Output Mode: Sampled Environment

Reflective: Disabled

Spread: 0.8


Disabled

0.001


Enabled

0.8


Enabled

0.001



Occlusion In Alpha

Normally, the alpha channel returned by the AO node contains the interpolated alphas of the Bright/Dark colors. If "Occlusion In Alpha" is enabled, the alpha channel is replaced by a value which ranges between 0.0 and 1.0, where 0.0 means "totally occluded" and 1.0 means "totally unoccluded".


Consider Same Object Only

This options controls whether the occlusion result will take into consideration objects other than the objects with AO applied to it. 

By default this option is disabled, meaning all objects in the scene are considered for occlusion. When enabled, each object with AO applied to it will only consider itself for occlusion.

In the example below the fire hydrant is made up of many different objects, for instance each link of the chain is a separate object. Note how the chain links no longer occlude on each other or the fire hydrant body, and the ground plane no longer occludes on the bottom of the fire hydrant. 


Consider Same Object Only: Disabled

Enabled



Bias Mode

This allows you to bias the occlusion in a custom direction, by default this is set to none.

Higher values will result in a more intense bias.


Bias Mode: World Space

Bias Coordinates (X,Y,Z): 0,0,0


1,0,0


100,0,0




Bias Mode: World Space

Bias Coordinates (X,Y,Z): 5,5,0

Spread: 0.1

Object Space

5,5,0


Object Space

-5,5,0


Other Uses: Dirtmaps / Masks

Here we'll show a simple example of how to use the AO node to achieve a "Dirtmap" type effect. The technique uses the result of a Y axis  biased AO shader as a mask to blend between two different things. In this example there are two  Redshift Material shaders, a clean hydrant shader and a dirty shader variant. To achieve this, we use the output of the AO node to drive a Material Blender's layer blend color. You can take this technique even further like using a Redshift  Color Layer to blend this AO result with other shaders like a RS Curvature for more complex procedural masking. By making use of the AO biasing the dirty hydrant shader is only revealed in occluded areas on the underside of the object as seen below.


Base Color: Clean Hydrant

Layer 1 Color: Dirty Hydrant

AO Blended Result


Pictured below is the shader graph used for this example.