Ambient Occlusion
Ambient occlusion (AO) darkens places that little indirect light can reach: creases, corners, the gap under a sofa, the ground right around a crate. It is computed every frame from the depth buffer or with rays, and multiplied with the occlusion texture of the material.
The result darkens all indirect light: the sky or ambient light, the diffuse global illumination and the specular GI. It does not darken direct light from light components; that is the job of shadows and contact shadows.
Algorithms
Rendering.AO.Algorithm (or AOAlgorithm on a post process volume) selects the algorithm:
| Value | Algorithm | Description |
|---|---|---|
| 0 | SSAO (default) | Screen-space ambient occlusion from the depth buffer. Cheap, works everywhere. Only sees what is on screen, so occlusion fades at the screen edges and behind thin objects. |
| 1 | MSAO | Multi-scale ambient occlusion (after Microsoft's MiniEngine). Combines several depth resolutions, so it catches both small creases and larger occluders. Compute only; it runs on the async compute queue when Rendering.AsyncQueues and Rendering.Async.MSAO are on. |
| 2 | RTAO | Ray-traced ambient occlusion. Traces short rays against the ray tracing scene, so it also sees occluders that are off screen or hidden, and is denoised over time. Needs hardware ray tracing and Rendering.RT.Enable. |
The quality presets do not change the algorithm; it is a project or scene choice. They only set the RTAO budgets (see CVars).
RTAO without ray tracing. When ray tracing is unavailable, RTAO logs a warning and outputs no occlusion at all (white), so the scene loses its AO. It does not fall back to SSAO. Use RTAO only where you know hardware ray tracing is on, or set SSAO for scenes that must also run without it.
AO and global illumination
Ray-traced diffuse GI with sky occlusion (the default for screen probes) already darkens enclosed spaces, because it only lets in the sky that rays can see. AO is applied on top of it. Large AO radii can therefore darken interiors twice; with ray-traced GI, keep Rendering.AO.Radius small so AO only adds the fine contact detail that GI probes are too coarse to resolve.
Without GI, AO is the only thing that darkens the sky light or ambient light in corners.
Post process volume
A Post Process Volume sets AO for the scene or an area in two groups.
Ambient Occlusion group (OverrideAmbientOcclusion):
| Property | Default | Description |
|---|---|---|
OverrideAmbientOcclusion | Off | Applies this group. |
AOAlgorithm | SSAO | SSAO, MSAO or RTAO. |
AORadius | 1 | World-space radius of the occlusion, 0.01 to 10. |
AOMaxScreenSpaceRadius | 1 | Largest screen-space radius (SSAO), 0.01 to 2. |
AOContrast | 2 | Contrast of the occlusion. |
AOIntensity | 0.7 | Strength of the occlusion. |
AOFadeOutStart, AOFadeOutEnd | 80, 100 | Distance range over which AO fades out. |
AOPositionBias | 5 | Offset that avoids self-occlusion on flat surfaces. |
AOMipLevelScale | 10 | Depth mip selection (SSAO). |
AODepthBlurThreshold | 2 | Depth difference at which the blur stops at edges. |
AOMSAOPower | 2 | Strength curve of MSAO, 0.5 to 5. |
Lighting RTAO group (OverrideRTAO):
| Property | Default | Description |
|---|---|---|
OverrideRTAO | Off | Applies this group. |
RTAORaysPerPixel | 1 | Rays per pixel, 1 to 8. |
RTAOSpatialPasses | 2 | Spatial denoise passes, 0 to 4. |
RTAODenoise | On | Temporal and spatial denoising. |
RTAOTemporal | On | Temporal accumulation. |
RTAOTemporalHistoryWeight | 0.9 | History weight of the temporal accumulation, 0 to 0.98. |
CVars
Not every algorithm reads every setting: SSAO uses the radius, screen-space radius, contrast, intensity, fade-out, position bias, mip level scale and depth blur threshold. MSAO uses Rendering.AO.MSAOPower. RTAO uses the radius, contrast, intensity, fade-out, position bias, depth blur threshold and the RTAO* settings.
| CVar | Default | Description |
|---|---|---|
Rendering.AO.Algorithm | 0 | 0 = SSAO, 1 = MSAO, 2 = RTAO. |
Rendering.AO.Radius | 1 | World-space radius. |
Rendering.AO.MaxScreenSpaceRadius | 1 | Largest screen-space radius. |
Rendering.AO.Contrast | 2 | Contrast. |
Rendering.AO.Intensity | 0.7 | Strength. |
Rendering.AO.FadeOutStart, Rendering.AO.FadeOutEnd | 80, 100 | Fade-out distance range. |
Rendering.AO.PositionBias | 5 | Self-occlusion offset. |
Rendering.AO.MipLevelScale | 10 | Depth mip selection. |
Rendering.AO.DepthBlurThreshold | 2 | Edge threshold of the blur. |
Rendering.AO.MSAOPower | 2 | MSAO strength curve. |
Rendering.AO.RTAORaysPerPixel | 1 | RTAO rays per pixel. Presets: Low 1, Medium 1, High and Max 2. |
Rendering.AO.RTAOSpatialPasses | 2 | RTAO spatial denoise passes. Presets: Low 1, Medium 2, High and Max 3. |
Rendering.AO.RTAODenoise | true | RTAO temporal and spatial denoising. |
Rendering.AO.RTAOTemporal | true | RTAO temporal accumulation. |
Rendering.AO.RTAOTemporalHistoryWeight | 0.9 | RTAO temporal history weight. |
Rendering.AO.RTAODebugMode | 0 | RTAO output: 0 = final, 1 = raw trace, 2 = after the temporal stage, 3 = history confidence. |
Rendering.Async.MSAO | true | Runs MSAO on the async compute queue (needs Rendering.AsyncQueues). |
In the editor's Quality Settings panel these settings are in the Ambient occlusion group as AO mode, Rays per pixel, Spatial passes, Ray traced denoise, Ray traced temporal accumulation, Radius (m) and Fade-out distance (m).
The render pipeline can also contain a line-sweep AO pass (plLSAOPass, set with the LSAO group of a post process volume). The shipped render pipelines do not use it.
Debugging
- Render Mode › Surface › Ambient Occlusion shows the material occlusion multiplied with the AO pass, which is what darkens the indirect light.
- Render Mode › Surface › Ray Traced AO shows the output of the AO pass alone, whichever algorithm is selected.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| AO disappeared after switching to RTAO | Ray tracing is unavailable; RTAO then outputs no occlusion. Check the log, turn on Rendering.RT.Enable on a supporting GPU, or use SSAO or MSAO. |
| Interiors are too dark with ray-traced GI | GI and AO both darken the indirect light. Lower Rendering.AO.Radius or Rendering.AO.Intensity. |
| AO fades at the screen edges | Screen-space limit of SSAO and MSAO. RTAO sees off-screen occluders. |
| RTAO is noisy or smears on moving objects | Raise Rendering.AO.RTAORaysPerPixel or the spatial passes, or lower Rendering.AO.RTAOTemporalHistoryWeight. |