Skip to content

Commit b675105

Browse files
authored
Changed the behavior the max ray length for recursive rendering to match RTR and rasterization. (#6643)
* Changed the behavior the max ray length for recursive rendering to match RTR and rasterization. * Update documentation
1 parent 1eceaae commit b675105

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
101101
- Replaced the geometry distance offset in the Probe Volume component by a minimum renderer volume threshold to ignore small objects when placing probes.
102102
- Small improvement changes in the UX for the Unlit Distortion field.
103103
- Improvements done to the water system (Deferred, Decals, SSR, Foam, Caustics, etc.).
104+
- Changed the behavior the max ray length for recursive rendering to match RTR and rasterization.
104105

105106
## [13.1.2] - 2021-11-05
106107

com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Recursive-Rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Since recursive rendering uses an independent render pass, HDRP cannot render an
3939
| -------------- | ------------------------------------------------------------ |
4040
| **LayerMask** | Defines the layers that HDRP processes this ray-traced effect for. |
4141
| **Max Depth** | Controls the maximum number of times a ray can reflect or refract before it stops and returns the final color. Increasing this value increases execution time exponentially. |
42-
| **Max Ray Length** | Controls the length of the rays that HDRP uses for ray tracing. If a ray doesn't find an intersection, then the ray returns the color of the sky. |
42+
| **Max Ray Length** | Controls the length of the rays that HDRP uses for ray tracing after the initial intersection. For the primary ray, HDRP uses the camera's near and far planes.|
4343
| **Min Smoothness** | Defines the threshold at which reflection rays are not cast if the smoothness value of the target surface is inferior to the one defined by the parameter. |
4444
| **Ray Miss** | Determines what HDRP does when recursive rendering doesn't find an intersection. Choose from one of the following options: <br/>&#8226;**Reflection probes**: HDRP uses reflection probes in your scene to calculate the last recursive rendering bounce.<br/>&#8226;**Sky**: HDRP uses the sky defined by the current [Volume](Volumes.md) settings to calculate the last recursive rendering bounce.<br/>&#8226;**Both** : HDRP uses both reflection probes and the sky defined by the current [Volume](Volumes.md) settings to calculate the last recursive rendering bounce.<br/>&#8226;**Nothing**: HDRP does not calculate indirect lighting when recursive rendering doesn't find an intersection.<br/><br/>This property is set to **Both** by default. |
4545
| **Last Bounce** | Determines what HDRP does when recursive rendering lights the last bounce. Choose from one of the following options: <br/>&#8226;**Reflection probes**: HDRP uses reflection probes in your scene to calculate the last bounce.<br/>&#8226;**Sky**: HDRP uses the sky defined by the current [Volume](Volumes.md) settings to calculate the last recursive rendering bounce.<br/>&#8226;**Both**: HDRP uses both reflection probes and the sky defined by the current [Volume](Volumes.md) settings to calculate the last recursive rendering bounce.<br/>&#8226;**Nothing**: HDRP does not calculate indirect lighting when it evaluates the last bounce.<br/><br/>This property is set to **Both** by default. |

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingRenderer.raytrace

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ void RayGenRenderer()
9595
RayDesc rayDescriptor;
9696
rayDescriptor.Origin = originWS;
9797
rayDescriptor.Direction = incidentWS;
98-
rayDescriptor.TMin = _RaytracingCameraNearPlane;
99-
rayDescriptor.TMax = _RaytracingRayMaxLength;
98+
99+
// For the initial ray, we don't want to have any disparity between the rasterization and ray tracing (which objects are rendered)
100+
// thus we need to force the max distance to the far plane.
101+
rayDescriptor.TMin = _ProjectionParams.y;
102+
rayDescriptor.TMax = _ProjectionParams.z;
100103

101104
// Adjust world-space position to match the RAS setup with XR single-pass and camera relative
102105
ApplyCameraRelativeXR(rayDescriptor.Origin);

0 commit comments

Comments
 (0)