From d6ed053197c01b16465677418065470a2a1cf5cc Mon Sep 17 00:00:00 2001 From: Anis Date: Tue, 30 Jun 2020 17:56:09 +0200 Subject: [PATCH 1/5] Fix an issue with the quality mode and perf mode on RTR and RTGI and getting rid of unwanted nans (1256923) --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/Lighting/GlobalIllumination.cs | 3 ++- .../Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs | 3 ++- .../Raytracing/Shaders/Denoising/ReflectionDenoiser.compute | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 50c16b1e506..2cd38c9d11e 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -700,6 +700,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Force to rebake probe with missing baked texture. (1253367) - Fix supported Mac platform detection to handle new major version (11.0) properly - Fixed typo in the Render Pipeline Wizard under HDRP+VR +- Fix an issue with the quality mode and perf mode on RTR and RTGI and getting rid of unwanted nans (1256923). ### Changed - Improve MIP selection for decals on Transparents diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs index eba7d983fef..2d3486430e9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs @@ -11,7 +11,8 @@ public sealed class GlobalIllumination : VolumeComponentWithQuality { bool UsesQualityMode() { - return mode.overrideState && mode == RayTracingMode.Quality; + // The default value is to quality. So we should be quality if no override or we have an override to quality + return !mode.overrideState || mode == RayTracingMode.Quality; } /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs index 181f57109c7..f7aef08a857 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs @@ -11,7 +11,8 @@ public class ScreenSpaceReflection : VolumeComponentWithQuality { bool UsesRayTracingQualityMode() { - return mode.overrideState && mode == RayTracingMode.Quality; + // The default value is to quality. So we should be quality if no override or we have an override to quality + return !mode.overrideState || mode == RayTracingMode.Quality; } bool UsesRayTracing() diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute index ca6004140da..bb21df6fdfd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/ReflectionDenoiser.compute @@ -165,9 +165,13 @@ void BILATERAL_FILTER(uint3 dispatchThreadId : SV_DispatchThreadID, uint2 groupT float3 colorSum = float3(0.0, 0.0, 0.0); float wSum = 0.0; - uint2 tapCoord = centerCoord - effectiveRadius * passIncr; + int2 tapCoord = centerCoord - effectiveRadius * passIncr; for (int r = -effectiveRadius; r <= effectiveRadius; ++r, tapCoord += passIncr) { + // Make sure the pixel coord we are trying to use is in the screen (not out of bounds) + if (tapCoord.x >= _ScreenSize.x || tapCoord.x < 0 || tapCoord.y >= _ScreenSize.y || tapCoord.y < 0) + continue; + // Compute the weight (skip computation for the center) const BilateralData tapData = TapBilateralData(tapCoord); float w = r ? gaussian(r, sigma) * ComputeBilateralWeight(center, tapData) : 1.0; From 973594739706875fcc59ae453db93e9e3458e95c Mon Sep 17 00:00:00 2001 From: anisunity <42026998+anisunity@users.noreply.github.com> Date: Wed, 1 Jul 2020 10:10:47 +0200 Subject: [PATCH 2/5] Update GlobalIllumination.cs --- .../Runtime/Lighting/GlobalIllumination.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs index 2d3486430e9..be11bc7f82f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs @@ -11,7 +11,7 @@ public sealed class GlobalIllumination : VolumeComponentWithQuality { bool UsesQualityMode() { - // The default value is to quality. So we should be quality if no override or we have an override to quality + // The default value is to quality. So we should be in quality if not overriden or we have an override set to quality return !mode.overrideState || mode == RayTracingMode.Quality; } From 231b7628e355cf64721e8edaf35691cf4ba51cf5 Mon Sep 17 00:00:00 2001 From: anisunity <42026998+anisunity@users.noreply.github.com> Date: Wed, 1 Jul 2020 10:11:02 +0200 Subject: [PATCH 3/5] Update ScreenSpaceReflection.cs --- .../Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs index f7aef08a857..1fc12abeb33 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs @@ -11,7 +11,7 @@ public class ScreenSpaceReflection : VolumeComponentWithQuality { bool UsesRayTracingQualityMode() { - // The default value is to quality. So we should be quality if no override or we have an override to quality + // The default value is to quality. So we should be in quality if not overriden or we have an override set to quality return !mode.overrideState || mode == RayTracingMode.Quality; } From b696f44a74dfba18aa3ad1298ef6d817cd8f51de Mon Sep 17 00:00:00 2001 From: anisunity <42026998+anisunity@users.noreply.github.com> Date: Wed, 1 Jul 2020 10:13:30 +0200 Subject: [PATCH 4/5] Update GlobalIllumination.cs --- .../Runtime/Lighting/GlobalIllumination.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs index be11bc7f82f..6a5388566b1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs @@ -11,7 +11,7 @@ public sealed class GlobalIllumination : VolumeComponentWithQuality { bool UsesQualityMode() { - // The default value is to quality. So we should be in quality if not overriden or we have an override set to quality + // The default value is set to quality. So we should be in quality if not overriden or we have an override set to quality return !mode.overrideState || mode == RayTracingMode.Quality; } From 828a99e6c372b0c0cdb9e5d1a62317e84254f5ae Mon Sep 17 00:00:00 2001 From: anisunity <42026998+anisunity@users.noreply.github.com> Date: Wed, 1 Jul 2020 10:13:42 +0200 Subject: [PATCH 5/5] Update ScreenSpaceReflection.cs --- .../Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs index 1fc12abeb33..eebc3628114 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs @@ -11,7 +11,7 @@ public class ScreenSpaceReflection : VolumeComponentWithQuality { bool UsesRayTracingQualityMode() { - // The default value is to quality. So we should be in quality if not overriden or we have an override set to quality + // The default value is set to quality. So we should be in quality if not overriden or we have an override set to quality return !mode.overrideState || mode == RayTracingMode.Quality; }