From f2aa6c629d980ede2d435203131eb77a9aa3a43e Mon Sep 17 00:00:00 2001 From: Fabien Houlmann Date: Fri, 16 Oct 2020 12:57:29 -0400 Subject: [PATCH 1/3] fix XR shadows culling --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/RenderPipeline/HDRenderPipeline.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index e4f142d1b14..11b8bf0320c 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -166,6 +166,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed null reference in the Undo callback of the graphics compositor - Fixed cullmode for SceneSelectionPass. - Fixed issue that caused non-static object to not render at times in OnEnable reflection probes. +- Fixed XR shadows culling. ### Changed - Preparation pass for RTSSShadows to be supported by render graph. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 6bddb91693b..3a8043064e7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -3292,6 +3292,9 @@ out ScriptableCullingParameters cullingParams if (hdCamera.xr.enabled) { cullingParams = hdCamera.xr.cullingParams; + + // Sync the FOV on the camera to match the projection from the XR device in order to cull shadows accurately + camera.fieldOfView = Mathf.Rad2Deg * Mathf.Atan(1.0f / cullingParams.stereoProjectionMatrix.m11) * 2.0f; } else { From a340a843675e8cb9a8140b4673a68973558c8f32 Mon Sep 17 00:00:00 2001 From: Fabien Houlmann Date: Thu, 29 Oct 2020 14:24:43 -0400 Subject: [PATCH 2/3] do not update the fieldOfView if usePhysicalProperties is active --- .../Runtime/RenderPipeline/HDRenderPipeline.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 281df476e2c..35278bbf5a2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -3298,7 +3298,8 @@ out ScriptableCullingParameters cullingParams cullingParams = hdCamera.xr.cullingParams; // Sync the FOV on the camera to match the projection from the XR device in order to cull shadows accurately - camera.fieldOfView = Mathf.Rad2Deg * Mathf.Atan(1.0f / cullingParams.stereoProjectionMatrix.m11) * 2.0f; + if (!camera.usePhysicalProperties) + camera.fieldOfView = Mathf.Rad2Deg * Mathf.Atan(1.0f / cullingParams.stereoProjectionMatrix.m11) * 2.0f; } else { From 5aff78ea365a27d1120e55699978d9619c96c744 Mon Sep 17 00:00:00 2001 From: Fabien Houlmann Date: Thu, 29 Oct 2020 14:29:16 -0400 Subject: [PATCH 3/3] re-add changelog entry --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index cd128d0d41e..4b5dd515fd4 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [11.0.0] - 2020-10-21 +### Fixed +- Fixed XR shadows culling + Version Updated The version number for this package has increased due to a version update of a related graphics package.