Use Screen Space Global Illumination
The Screen Space Global Illumination (SSGI) override is a High Definition Render Pipeline (HDRP) feature that uses the depth and color buffer of the screen to calculate diffuse light bounces.
HDRP implements ray-traced global illumination (RTGI) on top of this override. This means that the properties visible in the Inspector change depending on whether you enable ray tracing.
SSGI and RTGI replace all lightmap and Light Probe data. If you enable this override on a Volume that affects the Camera, Light Probes and the ambient probe stop contributing to lighting for GameObjects.
Enable Screen Space Global Illumination
To use this feature in your Scene, you must first enable it for your project and then enable it for your Cameras. To enable features in your project, you use the HDRP Asset and to enable features for your Cameras, you use Frame Settings. You can enable features either for all Cameras, using the Default Frame Settings, or for specific Cameras, by overriding each Camera's individual Frame Settings.
To enable SSGI:
- Open your HDRP Asset in the Inspector.
- Go to Lighting and enable Screen Space Global Illumination.
- Go to Edit > Project Settings > Graphics > HDRP Global Settings > Frame Settings (Default Values) > Lighting and enable Screen Space Global Illumination.
Use Screen Space Global Illumination
HDRP uses the Volume framework to calculate SSGI, so to enable and modify SSGI properties, you must add a Screen Space Global Illumination override to a Volume in your Scene. To add Screen Space Global Illumination to a Volume:
- In the Scene or Hierarchy view, select a GameObject that contains a Volume component to view it in the Inspector.
- In the Inspector, go to Add Override > Lighting and select Screen Space Global Illumination. HDRP now calculates SSGI for any Camera this Volume affects.
API
To access and control this override at runtime, use the Volume scripting API. Because of how the Volume system works, you edit properties in a different way to standard Unity components. There are also other nuances to be aware of too, such as each property has an overrideState. This indicates to the Volume system whether to use the property value you set, or use the default value stored in the Volume Profile. For information on how to use the API correctly, see Volume scripting API.
Tracing modes
The properties visible in the Inspector change depending on the option you select from the Tracing drop-down:
- To use a screen-space, ray-marched solution, select Ray Marching and see Screen-space for the list of properties.
- To use ray tracing, select Ray Tracing and see Ray-traced for the list of properties.
- To use a combination of ray tracing and ray marching, select Mixed and see Ray-traced for the list of properties. For more information about mixed tracing mode, see mixed tracing
Mixed tracing
This option uses ray marching to intersect on-screen geometry and uses ray tracing to intersect off-screen geometry. This enables HDRP to include on-screen opaque particles, vertex animations, and decals when it processes the effect. This option only works in Performance mode and with Lit Shader Mode setup to Deferred.
In Mixed tracing mode, HDRP processes screen-space ray marching in the GBuffer. This means that it can only use GameObjects rendered using the deferred rendering path. For example, HDRP renders transparent GameObjects in the forward rendering path which means they don't appear in the GBuffer or in effects that use mixed tracing.
In Mixed tracing mode, HDRP still uses ray tracing for any geometry inside the ray tracing acceleration structure, regardless of whether vertex animation or decals modify the geometry's surface. This means if HDRP fails to intersect the on-screen deformed geometry, it intersects the original mesh inside in the ray tracing acceleration structure. This may cause visual discrepancies between what you see and what you expect. For example, the following Scene contains a cliff that uses mesh deformation.
In this Scene, Mixed mode can include reflections for the opaque leaf particles, the white decal, and for GameObjects that aren't visible in the cliff face's original, non-deformed, geometry.
Ray tracing mode doesn't render reflections for the white decal or for the opaque leaf particles. Also, reflection rays intersect with the original, non-deformed, cliff face geometry which means they can not see the rock and bush on the right-hand side. To see the Scene from the perspective of the ray tracing mode, see the following image.
This is the Scene from the perspective of the ray tracing mode. See how the original, non-deformed, cliff face geometry hides the rock and bush that were on the right-hand side of the Scene.
Tracing Modes Limitation
Ray Marching
- Transparent Emissive Material are only taken into account when you set Rendering Pass to Before Refraction.
Ray Tracing
- Transparent Emissive Material aren't taken into account.
- No decals are supported including Emissive Decals.
Mixed Tracing
- The Mixed tracing mode is only useful if you set the Lit shader mode to Deferred and have the same limitation than Ray Tracing mode.
Properties
To learn about SSGI properties, refer to Screen Space Global Illumination (SSGI) reference.
Limitations
- SSGI is not compatible with Reflection Probes.
- When you set Lit Shader mode to Deferred the Ambient Occlusion from Lit Shader will combine with Screen Space Ambient Occlusion and apply to the indirect lighting result where there is no Emissive contribution. This is similar behavior to rendering with Lit Shader mode set to Forward. If the Material has an emissive contribution then Ambient Occlusion is set to one.