TA Toolbox Home / TA Glossary

SSAO Screen Space Ambient Occlusion: Principles and Implementation

2026-08-24

What is SSAO

SSAO (Screen Space Ambient Occlusion) is a post-processing effect that approximates ambient occlusion (AO). In the real world, corners and crevices receive less ambient light due to occlusion by surrounding geometry, making them darker. SSAO estimates the occlusion of each pixel by analyzing depth and normal information in screen space, outputs a grayscale mask, and applies it to ambient lighting, enhancing depth and realism.

Principles of SSAO

The core idea of SSAO: For each pixel on screen, sample the surrounding depth buffer within a hemisphere oriented along the normal. Compare the sampled depth with the pixel's own depth to determine if the sample point lies in front of the surface (i.e., occluded). If many samples are occluded, the pixel's occlusion factor is low and the color becomes darker.

Specific steps:

  1. Obtain depth and normal information in screen space (usually from G-Buffer).
  2. For each pixel, generate random sample points within its hemisphere (with rotating noise).
  3. Project sample points to screen space and sample the depth buffer.
  4. Compare sampled depth with surface depth; if sample depth is greater, that direction is occluded.
  5. Combine results from all samples to compute the occlusion factor.
  6. Output an occlusion texture used to modulate ambient lighting.
  7. Implementation and Optimization of SSAO

    There are several SSAO variants, such as Crytek's original SSAO, HBAO (Horizon-Based Ambient Occlusion), and GTAO (Ground Truth Ambient Occlusion). In Unity and Unreal, post-processing stacks provide SSAO options.

    Optimization techniques:

    • **Downsampling**: Compute SSAO at lower resolution, then upsample and blur.
    • **Reduce sample count**: Typically 8-16 samples with random rotation and blur.
    • **Hemisphere sampling**: Restrict samples to the hemisphere around the normal to reduce invalid samples.
    • **Depth range limiting**: Only consider occluders within a certain distance to avoid distant irrelevant occlusion.

    Pros and Cons of SSAO

    **Pros**:

    • Good real-time performance, no precomputation.
    • Works with dynamic scenes and arbitrary geometry.
    • Enhances visual realism, especially for small-scale details.

    **Cons**:

    • Screen-space limitations: only uses visible pixel information, cannot handle off-screen occluders.
    • May produce flickering and noise, requiring blur.
    • Can generate artifacts at depth discontinuities (e.g., foreground object incorrectly occluding background).

    Comparison with Other AO Techniques

    • **Baked AO**: Offline precomputation baking AO into textures or vertex colors, suitable for static scenes, zero runtime cost.
    • **Ray-traced AO**: Uses hardware ray tracing for precise results but expensive and requires modern GPUs.
    • **SSAO**: Real-time approximation, moderate cost, the most common dynamic AO technique.

    FAQ

    What is the difference between SSAO and AO?

    AO is a general term for ambient occlusion techniques; SSAO is a screen-space real-time approximation. Other methods include baked AO and ray-traced AO.

    Does SSAO significantly impact performance?

    SSAO requires multiple depth samples and post-processing, impacting performance, but can be controlled with optimization.

    Can SSAO be used on mobile?

    Mobile GPUs have limited performance; SSAO may be too expensive. Simplified versions or prebaked AO can be used.

    How to reduce SSAO noise?

    Use random rotation noise, increase sample count, or apply blur filters (e.g., bilateral filtering).

    Does SSAO require normal information?

    Yes, normals are needed to determine the sampling hemisphere orientation, usually obtained from G-Buffer. If not available, normals can be reconstructed from depth.

FAQ

What is the difference between SSAO and AO?

AO is a general term for ambient occlusion techniques; SSAO is a screen-space real-time approximation.

Does SSAO significantly impact performance?

SSAO requires multiple depth samples and post-processing, impacting performance, but can be controlled with optimization.

Can SSAO be used on mobile?

Mobile GPUs have limited performance; SSAO may be too expensive. Simplified versions or prebaked AO can be used.

How to reduce SSAO noise?

Use random rotation noise, increase sample count, or apply blur filters (e.g., bilateral filtering).

Does SSAO require normal information?

Yes, normals are needed to determine the sampling hemisphere orientation, usually obtained from G-Buffer. If not available, normals can be reconstructed from depth.