Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
Version Updated
The version number for this package has increased due to a version update of a related graphics package.

### Fixed
- Fixed issue when linking the field of view with the focal length in physical camera
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to 10.2


## [10.2.0] - 2020-10-19

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down