CORTAO for Unity
On this page
CORTAO adds screen-space ambient occlusion (AO) to opaque lighting. It reads camera depth and normals. It treats nearby samples as circular occluders and counts how many hemisphere rays they block. A spatial filter smooths the result and preserves surface edges.
Requirements#
| Unity | Universal Render Pipeline | High Definition Render Pipeline |
|---|---|---|
| 6.0 | 17.0.4 | 17.0.4 |
| 6.3 | 17.3.0 | 17.3.0 |
| 6.6 | 17.6.0 | 17.6.0 |
Install the Unity Registry package for your pipeline. CORTAO needs a graphics device that supports compute shaders. The reference platform is Windows with Direct3D 11.
The URP component uses the 3D Universal Renderer with Render Graph. It supports Forward, Forward+, Deferred, and Deferred+ where Unity offers that mode. It runs on Base Game cameras in its scene and on Scene View cameras for the active scene. Overlay cameras draw over the Base camera result. URP Compatibility Mode, the 2D Renderer, XR, and hardware dynamic resolution bypass the effect. URP Render Scale works with the component.
Enable CORTAO in URP#
- Open
Universal/Samples/CORTAO Demo/CORTAO Demo.unity. - Select the CORTAO GameObject in the Hierarchy. The demo opens with Show Ambient Occlusion enabled. White shows open surfaces. Dark pixels show occlusion.
- Clear Show Ambient Occlusion to see the lit scene.
- Toggle the Cortao Scene component to compare the lighting with CORTAO on and off.
In your own scene, add Rendering > CORTAO to an active GameObject. Set the controls on that object. CORTAO attaches its render passes when the scene renders. If Unity's built-in Screen Space Ambient Occlusion is active, CORTAO takes its place for cameras in the scene while the component is enabled.
URP controls#
| Control | Default | Effect |
|---|---|---|
| Intensity | 1 | Controls how dark the occlusion becomes. Zero turns off the pass. |
| Direct Lighting Strength | 0.25 | Sets how much occlusion affects direct light. At zero, CORTAO still affects indirect lighting. |
| Radius | 1.2 | Sets the distance in scene units over which surfaces can occlude each other. |
| Maximum Radius In Pixels | 80 | Caps the projected radius in full-resolution pixels. |
| Disk Samples | 16 | Tests 4 to 32 samples per trace pixel. More samples cost more GPU time. |
| Hemisphere Rays | 16 | Selects 16 or 32 rays in the occluder table. |
| Full Resolution | Off | Enable this option to trace at camera resolution. Half resolution uses the nearest surface in each 2 × 2 area and reconstructs edges from depth and normals. |
| Temporal Accumulation | On | Reuses visibility from earlier frames when URP provides motion vectors and camera history. Depth and normals reject history from a different surface. |
| Spatial Bilateral Aggressiveness | 0.15 | Higher values reduce filtering across surfaces with different normals. |
| Show Ambient Occlusion | Off | Displays the final visibility mask before post-processing. Disable camera post-processing for a neutral comparison. |
Start with half resolution and 16 disk samples. Increase Radius to extend the reach of the effect. If thin edges break up at half resolution, enable Full Resolution. For a still capture, let the temporal history settle or disable Temporal Accumulation for a fixed sampling pattern.
Enable CORTAO in HDRP#
- Set an HDRP asset as the active render pipeline.
- Choose Tools > CORTAO > Import HDRP Support and complete the import.
- Choose Tools > CORTAO > Install HDRP Integration.
- Open
High Definition/Samples/CORTAO Demo/CORTAO Demo.unity. Select CORTAO in the Hierarchy to find the component and Volume. - In your own scene, add CORTAO Renderer to an active GameObject.
- Add Ambient Occlusion to an HDRP Volume. Set Intensity above zero and select screen-space AO.
- Enable SSAO in the HDRP asset and in the camera's Frame Settings.
Choose Tools > CORTAO > AO Debug View to inspect the mask. HDRP uses stock AO when all CORTAO Renderer components are inactive. Before you remove CORTAO, choose Tools > CORTAO > Restore HDRP Integration to restore both compute shader references in HDRP Global Settings.
HDRP controls#
HDRP reads the settings from the Volume stack for each camera. Choose Custom quality to set the sample counts. Step Count uses two disk samples per step, with a range of 4 to 32 samples. Direction Count values 1 to 4 select 16 rays, and values 5 to 6 select 32 rays. Disable Temporal Accumulation to edit Direction Count. HDRP keeps the value when you enable accumulation again.
Radius, Maximum Radius In Pixels, and Full Resolution control the trace area. Spatial Bilateral Aggressiveness controls how much the filter crosses surface normals. HDRP uses its own motion vectors for temporal reprojection and its own bilateral upsampling at half resolution. Direct Lighting Strength controls the weight of AO on direct illumination.
Troubleshooting#
| What you see | What to check |
|---|---|
| CORTAO has no effect in URP | Check that the Cortao Scene component is enabled in the Base camera's scene. Enable Render Graph where Unity offers a Compatibility Mode switch. |
| An object is missing from the mask | The trace only sees surfaces that write depth and normals. Check that your opaque material provides those passes. Geometry outside the camera view contributes no samples. |
| Occlusion looks too dark | Reduce Intensity, Radius, or Direct Lighting Strength. |
| The HDRP debug view shows stock AO | Check that CORTAO Renderer is enabled and that both HDRP integration references are installed. Verify the active Volume and camera Frame Settings. |
CORTAO uses the ray-mask tables and adapts the tracing and filter code from Daniel Isheden's CORTAO v1.0.3 under the MIT License. Third-party notices