diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index e9b2e0ec6bb..f23e3d2cac9 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -97,6 +97,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed exceptions related to the debug display settings when changing the default frame settings. - Fixed picking for materials with depth offset. - Fixed issue with exposure history being uninitialized on second frame. +- 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. 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..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,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(); }