Skip to main content
Version: Next (dev)

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:

ValueAlgorithmDescription
0SSAO (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.
1MSAOMulti-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.
2RTAORay-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):

PropertyDefaultDescription
OverrideAmbientOcclusionOffApplies this group.
AOAlgorithmSSAOSSAO, MSAO or RTAO.
AORadius1World-space radius of the occlusion, 0.01 to 10.
AOMaxScreenSpaceRadius1Largest screen-space radius (SSAO), 0.01 to 2.
AOContrast2Contrast of the occlusion.
AOIntensity0.7Strength of the occlusion.
AOFadeOutStart, AOFadeOutEnd80, 100Distance range over which AO fades out.
AOPositionBias5Offset that avoids self-occlusion on flat surfaces.
AOMipLevelScale10Depth mip selection (SSAO).
AODepthBlurThreshold2Depth difference at which the blur stops at edges.
AOMSAOPower2Strength curve of MSAO, 0.5 to 5.

Lighting RTAO group (OverrideRTAO):

PropertyDefaultDescription
OverrideRTAOOffApplies this group.
RTAORaysPerPixel1Rays per pixel, 1 to 8.
RTAOSpatialPasses2Spatial denoise passes, 0 to 4.
RTAODenoiseOnTemporal and spatial denoising.
RTAOTemporalOnTemporal accumulation.
RTAOTemporalHistoryWeight0.9History 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.

CVarDefaultDescription
Rendering.AO.Algorithm00 = SSAO, 1 = MSAO, 2 = RTAO.
Rendering.AO.Radius1World-space radius.
Rendering.AO.MaxScreenSpaceRadius1Largest screen-space radius.
Rendering.AO.Contrast2Contrast.
Rendering.AO.Intensity0.7Strength.
Rendering.AO.FadeOutStart, Rendering.AO.FadeOutEnd80, 100Fade-out distance range.
Rendering.AO.PositionBias5Self-occlusion offset.
Rendering.AO.MipLevelScale10Depth mip selection.
Rendering.AO.DepthBlurThreshold2Edge threshold of the blur.
Rendering.AO.MSAOPower2MSAO strength curve.
Rendering.AO.RTAORaysPerPixel1RTAO rays per pixel. Presets: Low 1, Medium 1, High and Max 2.
Rendering.AO.RTAOSpatialPasses2RTAO spatial denoise passes. Presets: Low 1, Medium 2, High and Max 3.
Rendering.AO.RTAODenoisetrueRTAO temporal and spatial denoising.
Rendering.AO.RTAOTemporaltrueRTAO temporal accumulation.
Rendering.AO.RTAOTemporalHistoryWeight0.9RTAO temporal history weight.
Rendering.AO.RTAODebugMode0RTAO output: 0 = final, 1 = raw trace, 2 = after the temporal stage, 3 = history confidence.
Rendering.Async.MSAOtrueRuns 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​

SymptomCause and fix
AO disappeared after switching to RTAORay 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 GIGI and AO both darken the indirect light. Lower Rendering.AO.Radius or Rendering.AO.Intensity.
AO fades at the screen edgesScreen-space limit of SSAO and MSAO. RTAO sees off-screen occluders.
RTAO is noisy or smears on moving objectsRaise Rendering.AO.RTAORaysPerPixel or the spatial passes, or lower Rendering.AO.RTAOTemporalHistoryWeight.

See Also​