Skip to content

Commit b0be75d

Browse files
Fix for potentially corrupted refraction result on xbox (#1699)
* try explicit NaN check * Typo * Add comment * changelog Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent 3d1adf2 commit b0be75d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6464
- Fixed issue with updating the compositor output when not in play mode (case 1266216)
6565
- Fixed warning with area mesh (case 1268379)
6666
- Fixed issue with diffusion profile not being updated upon reset of the editor.
67+
- Fixed an issue that lead to corrupted refraction in some scenarios on xbox.
6768

6869
### Changed
6970
- Preparation pass for RTSSShadows to be supported by render graph.

com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ float IntersectSphereProxy(EnvLightData lightData, float3 dirPS, float3 position
2727
{
2828
float sphereOuterDistance = lightData.proxyExtents.x;
2929
float projectionDistance = IntersectRaySphereSimple(positionPS, dirPS, sphereOuterDistance);
30+
projectionDistance = IsNaN(projectionDistance) ? -1.0f : projectionDistance; // Note that because we use IntersectRaySphereSimple, in case of a ill-set proxy, it could be that
31+
// the determinant in the ray-sphere intersection code ends up negative, leading to a NaN.
32+
// Rather than complicating the IntersectRaySphereSimple or switching to a more complex case, we cover that case this way.
3033
projectionDistance = max(projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape)
3134

3235
return projectionDistance;

0 commit comments

Comments
 (0)