Skip to content
SpecializedSource checked

Screen Space Ambient Occlusion

Approximates ambient occlusion from the visible depth buffer.

Quick Facts

Compact metadata for implementation and discovery.

Category
Rendering
Difficulty
Intermediate
Family
Screen-Space Effect
Tier
Specialized
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
3
Code example
Not ready
Visualization
Ready
Aliases
SSAO

Overview

SSAO samples nearby screen-space depths to estimate local occlusion without tracing the full scene.

Core Concepts

rendered imageocclusion samplingdeadline constraintscreen-space effectscene representationvisibility testpixel output

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(p s)

Average

O(p s)

Worst

O(p s)

Space

O(p)

When to Use

  • Use Screen Space Ambient Occlusion when you need to sample depth around each screen pixel.
  • Use it for real-time rendering with inputs like depth buffer.
  • Use it when the scene representation and quality target match the rendering tradeoff.
  • Use it when the Screen-Space Effect tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid it when worst-case timing cannot be bounded well enough.
  • Avoid it when the cost per pixel or sample is too high for the desired frame rate.
  • Avoid it when the required output is not screen-space occlusion texture.

What It Does

  • Samples depth around each screen pixel
  • Estimates local blocked light from visible geometry

Use Cases

  • Real-time rendering
  • Game post-processing
  • Contact shadow approximation

Inputs

  • Depth buffer
  • Normal buffer
  • Sample kernel

Outputs

  • Screen-space occlusion texture

Key Formulas (1)

Screen-space occlusion

occlusion = blockedsamples / samplecount
occlusion = blocked_samples / sample_count

Approximates local occlusion from nearby depth-buffer samples.

Pseudocode

  1. 1.Read each pixel's depth and normal
  2. 2.Sample nearby positions in screen space
  3. 3.Compare sample depths
  4. 4.Accumulate occlusion
  5. 5.Blur and apply the result

Canonical Example

Input
scene = one triangle, one camera, one light
Output
image pixels showing the visible triangle
Explanation
Screen Space Ambient Occlusion: The algorithm converts scene data into visible pixel results.

Implementation Notes

  • Keep the input contract explicit: Depth buffer; Normal buffer; Sample kernel.
  • Use this step as the implementation spine: Read each pixel's depth and normal.
  • Then preserve the next state change: Sample nearby positions in screen space.
  • Build tiny scenes with known geometry before testing complex materials or lighting.

Common Pitfalls

  • SSAO cannot account for geometry that is not visible in the current frame.
  • Ignoring coordinate spaces, depth precision, or sampling noise while debugging image artifacts.
  • Returning screen-space occlusion texture without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show a depth buffer producing dark contact regions.

Screen Space Ambient Occlusion mechanism walkthrough step 1 of 5
Step 1 of 5: Read each pixel's depth and normal
screen-space-occlusion

Notes

Screen Space Ambient Occlusion operates in O(p s) time and O(p) space within the Screen-Space Effect family. Key governing relation: occlusion = blocked_samples / sample_count. Often compared with Ambient Occlusion and Shadow Mapping.

Sources (1)

What each reference supports for this entry.

NVIDIA SSAO whitepaper

Documentation

NVIDIA implementation-oriented whitepaper for screen-space ambient occlusion.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

ApproximatesAmbient Occlusion

SSAO approximates ambient occlusion from screen-space depth and normals.

Often paired withDeferred Shading

SSAO is commonly computed from deferred rendering buffers.

Tags

GraphicsAmbient OcclusionReal Time