Screen-Space Ambient Occlusion
Darken tight creases and nearby surface contacts using the current scene depth buffer.
ssaoEffect evaluates screen-space ambient visibility, smooths it with a
depth-aware bilateral blur, and composites the result into scene color.
At a Glance​
| Property | Value |
|---|---|
| Export | ssaoEffect |
| Backend | WebGPU |
| Render passes | Four: evaluate, horizontal blur, vertical blur, and composite |
| Required binding | depthTexture |
| Optional binding | normalTexture when normalSource: 'normal-texture' |
| History | None |
Usage​
import {EffectRenderer} from '@luma.gl/engine/api';
import {ssaoEffect} from '@luma.gl/engine/effects';
const renderer = new EffectRenderer(device, {
effects: [
{effect: ssaoEffect, options: {
normalSource: 'normal-texture',
resolutionScale: 0.5
}}
]
});
renderer.render({
target: null,
sourceTexture: gBuffer.colorTexture,
bindings: gBuffer.getBindings(),
uniforms: {
ssaoEvaluate: {
nearPlane: 0.1,
farPlane: 200,
radius: 7,
bias: 0.03,
intensity: 1.35
}
}
});
Parameters​
| Parameter | Default | Description |
|---|---|---|
normalSource | 'reconstruct-from-depth' | Reconstruct normals from depth or consume an explicit normalTexture. |
resolutionScale | 1 | Relative resolution of all three occlusion intermediates. |
nearPlane | 0.1 | Camera near plane used to linearize hardware depth. |
farPlane | 200 | Camera far plane used to linearize hardware depth. |
radius | 7 | Screen-space sampling radius around the current pixel. |
bias | 0.03 | Depth tolerance that reduces self-occlusion. |
intensity | 1.35 | Strength of the accumulated occlusion estimate. |
Performance and Composition​
The evaluation stage visits 12 nearby depth samples; two subsequent
Depth-Aware Blur passes preserve foreground/background boundaries.
resolutionScale: 0.5 reduces intermediate pixel count to approximately one quarter. SSAO does
not maintain temporal history and composites onto the complete source color.
Choose GTAO when horizon integration, temporal stabilization, or ambient-only composition is required.
Related Effects​
- GTAO adds horizon-based visibility, temporal history, and ambient-only composition.
- Depth-Aware Blur explains the bilateral denoising stages.
- Outlines can consume the same depth and normal attachments.
Shared visibility and PBR workflow​
For a visibility texture rather than whole-color postprocessing, use
AmbientOcclusionPass. It reuses this evaluator
with depth-aware filtering and no temporal history. The
lighting effects guide explains none/cheap/good
choices, input conventions, and composition with direct shadows and environment lighting.