Legacy Documentation: Version 5.2
Screen Space Ambient Obscurance
Tilt Shift

Screen Space Ambient Occlusion

The Screen Space Ambient Occlusion (SSAO) image effect approximates Ambient Occlusion in realtime, as an image post-processing effect. It darkens creases, holes and surfaces that are close to each other. In real life, such areas tend to block out or occlude ambient light, hence they appear darker.

For a modern implementation of real-time ambient occlusion, have a look at the newer Screen Space Ambient Obscurance effect.

As with the other image effects, you must have the Standard Assets Effects package installed before it becomes available.

SSAO applied to the scene.
SSAO applied to the scene.
The same scene without SSAO for comparison. Note the differences at the corners where structures or grass meet the ground.
The same scene without SSAO for comparison. Note the differences at the corners where structures or grass meet the ground.

Properties

Property: Function:
Radius The maximum “radius” of a gap that will introduce ambient occlusion.
Sample Count Number of ambient occlusion samples. A higher count will give better quality but with a higher processing overhead.
Occlusion Intensity The degree of darkness added by ambient occlusion.
Blur Amount of blur to apply to the darkening. No blur (0) is much faster but the darkened areas will be noisy.
Downsampling The resolution at which calculations should be performed (for example, a downsampling value of 2 will work at half the screen resolution). Downsampling increases rendering speed at the cost of quality.
Occlusion Attenuation How fast occlusion should attenuate with distance.
Min Z Try increasing this value if there are artifacts.

Details

SSAO approximates ambient occlusion using an image processing effect. Its cost depends purely on screen resolution and SSAO parameters and does not depend on scene complexity as true AO would. However, the approximation tends to introduce artifacts. For example, objects that are outside of the screen do not contribute to occlusion and the amount of occlusion is dependent on viewing angle and camera position.

Note that SSAO is quite expensive in terms of processing time and generally should only be used on high-end graphics cards. Using SSAO will cause Unity to render the depth+normals texture of the camera which increases the number of draw calls and has a CPU processing overhead. However, the depth+normals texture then can be used for other effects as well (eg, Depth of Field). Once the texture is generated, the remainder of the SSAO effect is performed on the graphics card.

Hardware Support

This effect requires a graphics card that supports Shader Model 3 and depth textures. See the Graphics Hardware Capabilities and Emulation page for further details and a list of compliant hardware.

Screen Space Ambient Obscurance
Tilt Shift