From 9cca5166e248cab3ff1ff5dff37253c8cb15d0d5 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Mon, 9 Nov 2020 10:37:19 +0100 Subject: [PATCH 1/3] Fix issue when changing FoV with the physical camera fold-out closed --- .../CHANGELOG.md | 1 + .../RenderPipeline/Camera/HDCameraUI.Drawers.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index c062b1fc57d..fc7a267b763 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 - Fixed probe volumes debug views. +- Fixed issue when changing FoV with the physical camera fold-out closed. ## [10.2.0] - 2020-10-19 diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs index 455d9b2f070..c2213c8cc48 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs @@ -284,6 +284,18 @@ static void Drawer_Projection(SerializedHDCamera p, Editor owner) ? s_FovLastValue : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect); } + else if (s_FovChanged && (isPhysicalCamera && !p.projectionMatrixMode.hasMultipleDifferentValues)) + { + // If we have a physical camera, we should also update the focal length here, because the + // Drawer_PhysicalCamera will not be executed if the physical camera fold-out is closed + cam.verticalFOV.floatValue = fovAxisVertical + ? s_FovLastValue + : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect); + + float sensorLength = cam.fovAxisMode.intValue == 0 ? cam.sensorSize.vector2Value.y : cam.sensorSize.vector2Value.x; + float focalLengthVal = Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength); + cam.focalLength.floatValue = EditorGUILayout.FloatField(focalLengthContent, focalLengthVal); + } EditorGUILayout.Space(); } From a30fbf4a7c53e39d1090299d6c2cd645a3c57434 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Mon, 9 Nov 2020 10:51:56 +0100 Subject: [PATCH 2/3] Remove redundant ( ) --- .../Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs index c2213c8cc48..4bbc19eef20 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs @@ -284,7 +284,7 @@ static void Drawer_Projection(SerializedHDCamera p, Editor owner) ? s_FovLastValue : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect); } - else if (s_FovChanged && (isPhysicalCamera && !p.projectionMatrixMode.hasMultipleDifferentValues)) + else if (s_FovChanged && isPhysicalCamera && !p.projectionMatrixMode.hasMultipleDifferentValues) { // If we have a physical camera, we should also update the focal length here, because the // Drawer_PhysicalCamera will not be executed if the physical camera fold-out is closed From b219c8395ba4729834a87eadb35a583e7a7f7c70 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Tue, 10 Nov 2020 12:12:25 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index fc7a267b763..e7d41cbdd69 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -12,7 +12,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Fixed probe volumes debug views. -- Fixed issue when changing FoV with the physical camera fold-out closed. ## [10.2.0] - 2020-10-19 @@ -97,6 +96,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue causing errors in GenerateMaxZ when opaque objects or decals are disabled. - Fixed an issue with Bake button of Reflection Probe when in custom mode - Fixed exceptions related to the debug display settings when changing the default frame settings. +- Fixed issue when changing FoV with the physical camera fold-out closed. ### Changed - Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass.