diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 05cdbce9974..e7da8e8e8bb 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -62,6 +62,7 @@ The version number for this package has increased due to a version update of a r - Fixed issue when resizing Inspector window that make the DecalProjector editor flickers. - Fixed issue in DecalProjector editor when the Inspector window have a too small width: the size appears on 2 lines but the editor not let place for the second one. - Fixed issue (null reference in console) when selecting a DensityVolume with rectangle selection. +- Fixed issue when linking the field of view with the focal length in physical camera ### 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 e78b29b0d24..455d9b2f070 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 @@ -405,10 +405,14 @@ static void Drawer_PhysicalCamera(SerializedHDCamera p, Editor owner) using (new EditorGUI.PropertyScope(horizontal.rect, focalLengthContent, cam.focalLength)) using (var checkScope = new EditorGUI.ChangeCheckScope()) { + bool isPhysical = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased; + // We need to update the focal length if the camera is physical and the FoV has changed. + bool focalLengthIsDirty = (s_FovChanged && isPhysical); + float sensorLength = cam.fovAxisMode.intValue == 0 ? cam.sensorSize.vector2Value.y : cam.sensorSize.vector2Value.x; - float focalLengthVal = s_FovChanged ? Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength) : cam.focalLength.floatValue; + float focalLengthVal = focalLengthIsDirty ? Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength) : cam.focalLength.floatValue; focalLengthVal = EditorGUILayout.FloatField(focalLengthContent, focalLengthVal); - if (checkScope.changed || s_FovChanged) + if (checkScope.changed || focalLengthIsDirty) cam.focalLength.floatValue = focalLengthVal; }