Skip to content
CoreSource checked

Ambient Occlusion

Darkens areas where nearby geometry blocks ambient light.

Quick Facts

Compact metadata for implementation and discovery.

Category
Rendering
Difficulty
Intermediate
Family
Lighting Approximation
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
3
Code example
Not ready
Visualization
Ready
Aliases
AO

Overview

Ambient Occlusion estimates how exposed each surface point is to surrounding light and darkens creases or contact areas.

Core Concepts

rendered imageocclusion samplinglight contributionlighting approximationscene 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 Ambient Occlusion when you need to sample nearby visibility.
  • Use it for contact shadows with inputs like surface points or depth buffer.
  • Use it when the scene representation and quality target match the rendering tradeoff.
  • Use it when the Lighting Approximation tradeoff is acceptable for the problem size.

When Not to Use

  • 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 occlusion factor per point or pixel.

What It Does

  • Samples nearby visibility
  • Reduces light where geometry is enclosed

Use Cases

  • Contact shadows
  • Model previews
  • Realistic surface grounding

Inputs

  • Surface points or depth buffer
  • Sampling radius

Outputs

  • Occlusion factor per point or pixel

Key Formulas (1)

Occlusion estimate

occlusion = blockedsamples / totalsamples
occlusion = blocked_samples / total_samples

Estimates how much nearby geometry blocks ambient light.

Pseudocode

  1. 1.For each surface point, sample nearby directions or positions
  2. 2.Check how many samples are blocked
  3. 3.Average the blocked fraction
  4. 4.Apply the occlusion factor to shading

Canonical Example

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

Implementation Notes

  • Keep the input contract explicit: Surface points or depth buffer; Sampling radius.
  • Use this step as the implementation spine: For each surface point, sample nearby directions or positions.
  • Then preserve the next state change: Check how many samples are blocked.
  • Build tiny scenes with known geometry before testing complex materials or lighting.

Common Pitfalls

  • Ambient Occlusion approximates indirect shadowing rather than full light transport.
  • Ignoring coordinate spaces, depth precision, or sampling noise while debugging image artifacts.
  • Handle empty, invalid, and boundary inputs before trusting occlusion factor per point or pixel.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show creases darkening as nearby samples become blocked.

Ambient Occlusion mechanism walkthrough step 1 of 4
Step 1 of 4: For each surface point, sample nearby directions or positions
occlusion-samples

Notes

Ambient Occlusion operates in O(p s) time and O(p) space within the Lighting Approximation family. Key governing relation: occlusion = blocked_samples / total_samples. Often compared with Screen Space Ambient Occlusion and Path Tracing.

Sources (1)

What each reference supports for this entry.

Physically Based Rendering

Book

Rendering reference for light transport, ray tracing, sampling, BRDFs, acceleration structures, and path termination.

Open source

Explore Next

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

Conceptual neighborPath Tracing

Path tracing can estimate occlusion through sampled light transport.

SSAO approximates ambient occlusion from screen-space buffers.

Tags

GraphicsAmbient OcclusionLighting