Screen Space Reflection
The Screen Space Reflection (SSR) override is a High Definition Render Pipeline (HDRP) feature that uses the depth and color buffer of the screen to calculate reflections. For information about how SSR works in HDRP, see the reflection documentation.
HDRP implements ray-traced reflection on top of this override. This means that the properties visible in the Inspector change depending on whether or not you enable ray tracing.
Enabling Screen Space Reflection
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 SSR:
- Open your HDRP Asset in the Inspector.
- Go to Lighting > Reflections and enable Screen Space Reflection.
- Go to Edit > Project Settings > Graphics > HDRP Global Settings > Frame Settings (Default Values) > Lighting and enable Screen Space Reflection.
Using Screen Space Reflection
HDRP uses the Volume framework to calculate SSR, so to enable and modify SSR properties, you must add a Screen Space Reflection override to a Volume in your Scene. To add Screen Space Reflection 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 Reflection. HDRP now calculates SSR 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 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 |
---|---|
State (Opaque) | When set to Enabled, HDRP processes SSR on opaque objects for Cameras in the influence of this effect's Volume. |
State (Transparent) | When set to Enabled, HDRP processes SSR on transparent objects for Cameras in the influence of this effect's Volume. |
Tracing | Specifies the method HDRP uses to calculate reflections. 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 reflections. For the list of properties this option exposes, see Screen-space. • Ray Tracing: Uses ray tracing to calculate reflections. For information on ray-traced reflections, see ray-traced reflection. For the list of properties this option exposes, see Ray-traced. • Mixed: Uses a combination of ray tracing and ray marching to calculate reflections. For the list of properties this option exposes, see Ray-traced. |
Algorithm | Specifies the algorithm to use for the screen-space reflection effect. The options are: • Approximation: Approximates screen-space reflection to quickly calculate a result. This solution is less precise than PBR Accumulation, particularly for rough surfaces, but is less resource intensive. • PBR Accumulation: Accumulates multiple frames to calculate a more accurate result. You can control the amount of accumulation using Accumulation Factor. This solution might produce more ghosting than Approximation, due to the accumulation, and is also more resources intensive. HDRP does not apply this algorithm to transparent material and instead always uses Approximation. |
Minimum Smoothness | Use the slider to set the minimum amount of surface smoothness at which HDRP performs SSR tracing. Lower values result in HDRP performing SSR tracing for less smooth GameObjects. If the smoothness value of the pixel is lower than this value, HDRP falls back to the next available reflection method in the reflection hierarchy. |
Smoothness Fade Start | Use the slider to set the smoothness value at which SSR reflections begin to fade out. Lower values result in HDRP fading out SSR reflections for less smooth GameObjects. The fade is in the range [Minimum Smoothness, Smoothness Fade Start]. |
Reflect Sky | Indicates whether HDRP should use SSR to handle sky reflection. If you disable this property, pixels that reflect the sky use the next level of the reflection hierarchy. Note: SSR uses the depth buffer to calculate reflection and HDRP doesn't add transparent GameObjects to the depth buffer. If you enable this property, transparent GameObject that appear over the sky in the color buffer can cause visual artifacts and incorrect looking reflection. This is a common limitation for SSR techniques. |
Screen Edge Fade Distance | Use the slider to control the distance at which HDRP fades out screen space reflections when the destination of the ray is near the boundaries of the screen. Increase this value to increase the distance from the screen edge at which HDRP fades out screen space reflections for a ray destination. |
Object Thickness | Use the slider to control the thickness of the GameObjects on screen. 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. |
Quality | Specifies the quality level to use for this effect. Each quality level applies different preset values. Unity also stops you from editing the properties that the preset overrides. If you want to set your own values for every property, select Custom. |
- Max 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 reflections. |
Accumulation Factor | The speed of the accumulation convergence. 0 means no accumulation. 1 means accumulation is slow, which is useful for fixed images. The more accumulation, the more accurate the result but the more ghosting occurs when moving. When using accumulation, it's important to find a balance between convergence quality and the ghosting artifact. Also note that rougher reflective surfaces require more accumulation to produce a converged image without noise. This property only appears if you set Algorithm to PBR Accumulation. |
World Space Speed Rejection | When enabled, HDRP calculates speed in world space to reject samples. This property only appears if you set Algorithm to PBR Accumulation. |
Speed Rejection | Controls the likelihood that HDRP rejects history based on the previous frame motion vectors of both the surface and the GameObject that the sample hits. This property only appears if you set Algorithm to PBR Accumulation and enable Additional Properties from the contextual menu. |
Speed Rejection Scaler Factor | Controls the upper range of speed. The faster a GameObject or the Camera move, the higher this number is. This property only appears if you set Algorithm to PBR Accumulation enable Additional Properties from the contextual menu. |
Speed From Reflecting Surface | When enabled, HDRP rejects samples based on the reflecting surface movement. You must check this property or Speed From Reflected Surface. This property only appears if you set Algorithm to PBR Accumulation enable Additional Properties from the contextual menu. |
Speed From Reflected Surface | When enabled, HDRP rejects samples based on the reflected surface movement. You must check this property or Speed From Reflecting Surface. This property only appears if you set Algorithm to PBR Accumulation enable Additional Properties from the contextual menu. |
Speed Smooth Rejection | When enabled, HDRP can partially reject history for moving objects to create a smoother transition. When disabled, HDRP either rejects or keeps history. This property only appears if you enable World Space Speed Rejection enable Additional Properties from the contextual menu. |
Roughness Bias | Controls the relative roughness offset. A low value means material roughness stays the same, a high value results in smoother reflections. This property only appears if you set Algorithm to PBR Accumulation enable Additional Properties from the contextual menu. |
Debugging Speed Rejection
HDRP includes a Fullscreen Debug Mode called Screen Space Reflection Speed Rejection (menu: Lighting > Fullscreen debug mode > Screen Space Reflection Speed Rejection) that you can use to visualise the contribution of the following properties:
- Speed Rejection
- Speed Rejection Scaler Factor
- Speed From Reflecting Surface
- Speed From Reflected Surface
- Speed Smooth Rejection
This fullscreen debug mode uses a color scale from green to red. Green areas indicate the sample is accumulated according to the Accumulation Factor and red areas indicate that HDRP rejects this sample. Orange areas indicate a that HDRP accumulates some samples and rejects some samples in this area.
In the following example image, the car GameObject is in the center of the Camera's view. This means the car has no relative motion to the Camera.
This example image uses Speed From Reflected Surface to accumulate the samples from the car and partially accumulate the samples from the sky. This makes the car and its reflection appear green, and the surface that reflects the sky appear orange.
Ray-traced
Property | Description | |
---|---|---|
Tracing | Specifies the method HDRP uses to calculate reflections. 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 reflections. For the list of properties this option exposes, see Screen Space. • Ray Tracing: Uses ray tracing to calculate reflections. For information on ray-traced reflections, see Ray-Traced Reflections. For the list of properties this option exposes, see Ray-traced. • Mixed: Uses a combination of ray tracing and ray marching to calculate reflections. For the list of properties this option exposes, see Ray-traced. |
|
Ray Miss | Determines what HDRP does when ray-traced reflections (RTR) 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 RTR bounce. •Sky: HDRP uses the sky defined by the current Volume settings to calculate the last RTR bounce. •Both : HDRP uses both reflection probes and the sky defined by the current Volume settings to calculate the last RTR bounce. •Nothing: HDRP doesn't calculate indirect lighting when RTR doesn't find an intersection. This property is set to Both by default |
|
Last Bounce | Determines what HDRP does when ray-traced reflections (RTR) lights the last bounce. Choose from one of the following options: •Reflection probes: HDRP uses reflection probes in your scene to calculate the last RTR bounce. •Sky: HDRP uses the sky defined by the current Volume settings to calculate the last RTR bounce. •Both: HDRP uses both reflection probes and the sky defined by the current [Volume settings to calculate the last RTR bounce. •Nothing: HDRP doesn't calculate indirect lighting when it evaluates the last bounce. This property is set to Both by default. |
|
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. |
|
Minimum Smoothness | See Minimum Smoothness in Screen Space. | |
Smoothness Fade Start | See Smoothness Fade Start in Screen Space. | |
Max Ray Length | Controls the maximum length of reflection rays. The higher this value is, the more resource-intensive ray-traced reflection is if a ray doesn't find an intersection. | |
Clamp Value | Controls the threshold that HDRP uses to clamp the pre-exposed value. This reduces the range of values and makes the reflections 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 reflection 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 reflections. This property only appears if you set Tracing to Mixed. | |
Denoise | Enables the spatio-temporal filter that HDRP uses to remove noise from the reflections. | |
Denoiser Radius | Controls the radius of the spatio-temporal filter. Increasing this value results in a more blurry result and a higher execution time. | |
Affects Smooth Surfaces | Indicates whether the denoiser affects perfectly smooth surfaces (surfaces with a Smoothness of 1.0) or not. |
Limitations
Screen-space reflection
To calculate SSR, HDRP reads a color buffer with a blurred mipmap generated during the previous frame.
The color buffer only includes transparent GameObjects that use the BeforeRefraction Rendering Pass. However, HDRP incorrectly reflects a transparent GameObject using the depth of the surface behind it, even if you enable Depth Write in the GameObject's Material properties. This is because HDRP calculates SSR before it adds the depth of transparent GameObjects to the depth buffer.
If a transparent material has Receive SSR Transparent enabled, HDRP always uses the Approximation algorithm to calculate SSR, even you select PBR Accumulation.
When a transparent material has rendering pass set to Low Resolution, then Receive SSR Transparent can't be selected.
Ray-traced reflection
Currently, ray tracing in HDRP doesn't support decals. This means that, when you use ray-traced reflection, decals don't appear in reflective surfaces.
If a transparent material has Receive SSR Transparent enabled, HDRP will evaluate the reflections as smooth.