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 or not you enable ray tracing.
SSGI and RTGI completely replace all lightmap and Light Probe data. If you enable this override and the Volume affects the Camera, Light Probes, and the ambient probe, stop contributing to lighting for GameObjects.
Enabling 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.
For this feature: The property to enable in your HDRP Asset is: Lighting > Screen Space Global Illumination. The property to enable in your Frame Settings is: Lighting > Screen Space Global Illumination.
Using 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, navigate to Add Override > Lighting and click 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.
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 do not appear in the GBuffer and thus not 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 are not visible in the cliff face's original, non-deformed, geometry.
Ray tracing mode does not 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.
Properties
To edit properties in any Volume component override, enable the checkbox to the left of the property. This also tells HDRP to use the property value you specify for the Volume component rather than the default value. If you disable the checkbox, HDRP ignores the property you set and uses the Volume’s default value for that property instead.
Screen-space
Property | Description |
---|---|
Enable | Indicates whether HDRP processes SSGI for Cameras in the influence of this effect's Volume. |
Tracing | Specifies the method HDRP uses to calculate global illumination. Depending on the option you select, the properties visible in the Inspector change. For more information on what the options do, see tracing modes. The options are: • Ray Marching: Uses a screen-space ray marching solution to calculate global illumination. For the list of properties this option exposes, see Screen-space. • Ray Tracing: Uses ray tracing to calculate global illumination. For information on ray-traced global illumination, see ray-traced global illumination. For the list of properties this option exposes, see Ray-traced. • Mixed: Uses a combination of ray tracing and ray marching to calculate global illumination. For the list of properties this option exposes, see Ray-traced. |
Quality | Specifies the overall quality of the effect. The higher the quality, the more resource-intensive the effect is to process. |
Max Ray Steps | The number of ray steps to use to calculate SSGI. If you set this to a higher value, the quality of the effect improves, however it is more resource intensive to process. |
Denoise | Enable this to enable the spatio-temporal filter that HDRP uses to remove noise from the Ray-Traced global illumination. |
- Half Resolution Denoiser | Enable this feature to evaluate the spatio-temporal filter in half resolution. This decreases the resource intensity of denoising but reduces quality. |
- Denoiser Radius | Set the radius of the spatio-temporal filter. |
- Second Denoiser Pass | Enable this feature to process a second denoiser pass. This helps to remove noise from the effect. |
Full Resolution | Enable this feature to increase the ray budget to one ray per pixel, per frame. Disable this feature to decrease the ray budget to one ray per four pixels, per frame. |
Depth Tolerance | Use the slider to control the tolerance when comparing the depth of the GameObjects on screen and the depth buffer. Because the SSR algorithm can not distinguish thin GameObjects from thick ones, this property helps trace rays behind GameObjects. The algorithm applies this property to every GameObject uniformly. |
Ray Miss | Determines what HDRP does when a screen space global illumination (SSGI) ray doesn't find an intersection. Choose from one of the following options: •Reflection probes: HDRP uses reflection probes in your scene to calculate the missing SSGI intersection. •Sky: HDRP uses the sky defined by the current Volume settings to calculate the missing SSGI intersection. •Both: HDRP uses both reflection probes and the sky defined by the current Volume settings to calculate the missing SSGI intersection. •Nothing: HDRP does not calculate indirect lighting when SSGI doesn't find an intersection. This property is set to Both by default. |
Ray-traced
Property | Description |
---|---|
Ray Miss | Determines what HDRP does when ray-traced global illumination (RTGI) doesn't find an intersection. Choose from one of the following options: •Reflection probes: HDRP uses reflection probes in your scene to calculate the last RTGI bounce. •Sky: HDRP uses the sky defined by the current Volume settings to calculate the last RTGI bounce. •Both : HDRP uses both reflection probes and the the sky defined by the current Volume settings to calculate the last RTGI bounce. •Nothing: HDRP does not calculate indirect lighting when RTGI doesn't find an intersection. This property is set to Both by default |
Last Bounce | Determines what HDRP does when ray-traced global illumination (RTGI) lights the last bounce. Choose from one of the following options: •Reflection probes: HDRP uses reflection probes in your scene to calculate the last RTGI bounce. •Sky: HDRP uses the sky defined by the current Volume settings to calculate the last RTGI bounce. •Both: HDRP uses both reflection probes and the sky defined by the current Volume settings to calculate the last RTGI bounce. •Nothing: HDRP does not calculate indirect lighting when it evaluates the last bounce. This property is set to Both by default. |
Tracing | Specifies the method HDRP uses to calculate global illumination. Depending on the option you select, the properties visible in the Inspector change. For more information on what the options do, see tracing modes. The options are: • Ray Marching: Uses a screen-space ray marching solution to calculate global illumination. For the list of properties this option exposes, see Screen-space. • Ray Tracing: Uses ray tracing to calculate global illumination. For information on ray-traced global illumination, see ray-traced global illumination. For the list of properties this option exposes, see Ray-traced. • Mixed: Uses a combination of ray tracing and ray marching to calculate global illumination. For the list of properties this option exposes, see Ray-traced. |
LayerMask | Defines the layers that HDRP processes this ray-traced effect for. |
Mode | Defines if HDRP should evaluate the effect in Performance or Quality mode. This property only appears if you select set Supported Ray Tracing Mode in your HDRP Asset to Both. |
Quality | Specifies the preset HDRP uses to populate the values of the following nested properties. The options are: • Low: A preset that emphasizes performance over quality. • Medium: A preset that balances performance and quality. • High: A preset that emphasizes quality over performance. • Custom: Allows you to override each property individually. This property only appears if you set Mode to Performance. |
Max Ray Length | Controls the maximal length of rays. The higher this value is, the more resource-intensive ray traced global illumination is. |
Clamp Value | Set a value to control the threshold that HDRP uses to clamp the pre-exposed value. This reduces the range of values and makes the global illumination more stable to denoise, but reduces quality. |
Full Resolution | Enable this feature to increase the ray budget to one ray per pixel, per frame. Disable this feature to decrease the ray budget to one ray per four pixels, per frame. This property only appears if you set Mode to Performance. |
Sample Count | Controls the number of rays per pixel per frame. Increasing this value increases execution time linearly. This property only appears if you set Mode to Quality. |
Bounce Count | Controls the number of bounces that global illumination rays can do. Increasing this value increases execution time exponentially. This property only appears if you set Mode to Quality. |
Max Mixed Ray Steps | Sets the maximum number of iterations that the algorithm can execute before it stops trying to find an intersection with a Mesh. For example, if you set the number of iterations to 1000 and the algorithm only needs 10 to find an intersection, the algorithm terminates after 10 iterations. If you set this value too low, the algorithm may terminate too early and abruptly stop global illumination. This property only appears if you set Tracing to Mixed. |
Denoise | Enable this to enable the spatio-temporal filter that HDRP uses to remove noise from the Ray-Traced global illumination. |
- Half Resolution Denoiser | Enable this feature to evaluate the spatio-temporal filter in half resolution. This decreases the resource intensity of denoising but reduces quality. |
- Denoiser Radius | Set the radius of the spatio-temporal filter. |
- Second Denoiser Pass | Enable this feature to process a second denoiser pass. This helps to remove noise from the effect. |
Limitations
In Deferred rendering mode, Screen Space Global Illumination and Ray-Traced Global Illumination share a buffer with emissive, which overwrites emissive data. There are multiple ways to recover the emissive contribution of the scene materials:
- Disable Receive SSR/SSGI flag on the emissive materials.
- Use Force Forward Emissive on the emissive materials.
- Use Forward rendering.
Screen-space global illumination
- When rendering Reflection Probes screen space global illumination is not supported.
Ray-traced global illumination
Currently, ray tracing in HDRP does not support decals. This means that ray-traced global illumination does not affect decals in your Scene.
Mixed global illumination
In Mixed tracing mode, emissive decals do not contribute to global illumination because HDRP renders them later in the render pipeline. For the same reason, emissive Materials that use Force Forward Emissive also do not contribute to global illumination.