From 5218b7ec4998850abc1775603be95367187e56d5 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Wed, 26 Aug 2020 22:16:48 +0200 Subject: [PATCH 1/4] try explicit NaN check --- .../Runtime/Lighting/Reflection/VolumeProjection.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl index eec3ce341e8..1efcac60eba 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl @@ -27,7 +27,7 @@ float IntersectSphereProxy(EnvLightData lightData, float3 dirPS, float3 position { float sphereOuterDistance = lightData.proxyExtents.x; float projectionDistance = IntersectRaySphereSimple(positionPS, dirPS, sphereOuterDistance); - projectionDistance = max(projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape) + projectionDistance = max(isNaN(projectionDistance) ? 0 : projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape) return projectionDistance; } From e53819021a13985b82096965920d1472a6241b90 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Thu, 27 Aug 2020 09:35:10 +0200 Subject: [PATCH 2/4] Typo --- .../Runtime/Lighting/Reflection/VolumeProjection.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl index 1efcac60eba..1b5f3102803 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl @@ -27,7 +27,7 @@ float IntersectSphereProxy(EnvLightData lightData, float3 dirPS, float3 position { float sphereOuterDistance = lightData.proxyExtents.x; float projectionDistance = IntersectRaySphereSimple(positionPS, dirPS, sphereOuterDistance); - projectionDistance = max(isNaN(projectionDistance) ? 0 : projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape) + projectionDistance = max(IsNaN(projectionDistance) ? 0 : projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape) return projectionDistance; } From 5d01f072505d21fb677e4e97495a5b2df6169eaf Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Thu, 27 Aug 2020 18:21:57 +0200 Subject: [PATCH 3/4] Add comment --- .../Runtime/Lighting/Reflection/VolumeProjection.hlsl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl index 1b5f3102803..44b7a285695 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/VolumeProjection.hlsl @@ -27,7 +27,10 @@ float IntersectSphereProxy(EnvLightData lightData, float3 dirPS, float3 position { float sphereOuterDistance = lightData.proxyExtents.x; float projectionDistance = IntersectRaySphereSimple(positionPS, dirPS, sphereOuterDistance); - projectionDistance = max(IsNaN(projectionDistance) ? 0 : projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape) + projectionDistance = IsNaN(projectionDistance) ? -1.0f : projectionDistance; // Note that because we use IntersectRaySphereSimple, in case of a ill-set proxy, it could be that + // the determinant in the ray-sphere intersection code ends up negative, leading to a NaN. + // Rather than complicating the IntersectRaySphereSimple or switching to a more complex case, we cover that case this way. + projectionDistance = max(projectionDistance, lightData.minProjectionDistance); // Setup projection to infinite if requested (mean no projection shape) return projectionDistance; } From 40c438015aa7663aac7dede1e861ec027d150881 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Fri, 28 Aug 2020 16:53:30 +0200 Subject: [PATCH 4/4] changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 6a2fbb119e6..69a7c65f337 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Fix several issues with physically-based DoF (TAA ghosting of the CoC buffer, smooth layer transitions, etc) - Fixed GPU hang on D3D12 on xbox. +- Fixed an issue that lead to corrupted refraction in some scenarios on xbox. ### Changed - Preparation pass for RTSSShadows to be supported by render graph.