diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index b9344a039db..01318a4a716 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -165,6 +165,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a migration issue with the rendering queue in ShaderGraph when upgrading to 10.x; - Fixed null reference in the Undo callback of the graphics compositor - Fixed cullmode for SceneSelectionPass. +- Fixed XR shadows culling. ### Changed - Preparation pass for RTSSShadows to be supported by render graph. @@ -202,6 +203,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Changed which local frame is used for multi-bounce RTReflections. - Move System Generated Values semantics out of VaryingsMesh structure. - Other forms of FSAA are silently deactivated, when path tracing is on. +- Disable field of view UI settings when XR is enabled on the camera. ## [10.0.0] - 2019-06-10 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..15d1e7ae16d 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 @@ -200,10 +200,19 @@ static void Drawer_Projection(SerializedHDCamera p, Editor owner) var cam = p.baseCameraSettings; + // In XR mode, some settings can't be changed because the values come from the device + if (p.xrRendering.boolValue) + { + cam.orthographic.boolValue = false; + cam.fovAxisMode.intValue = (int)Camera.FieldOfViewAxis.Vertical; + p.projectionMatrixMode.intValue = (int)ProjectionMatrixMode.Implicit; + } + Rect perspectiveRect = EditorGUILayout.GetControlRect(); ProjectionType projectionType; EditorGUI.BeginProperty(perspectiveRect, projectionContent, cam.orthographic); + EditorGUI.BeginDisabledGroup(p.xrRendering.boolValue); { projectionType = cam.orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective; @@ -212,8 +221,9 @@ static void Drawer_Projection(SerializedHDCamera p, Editor owner) if (EditorGUI.EndChangeCheck()) cam.orthographic.boolValue = (projectionType == ProjectionType.Orthographic); } + EditorGUI.EndDisabledGroup(); EditorGUI.EndProperty(); - + if (cam.orthographic.hasMultipleDifferentValues) return; @@ -228,6 +238,7 @@ static void Drawer_Projection(SerializedHDCamera p, Editor owner) bool isPhysicalCamera = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased; var rect = EditorGUILayout.GetControlRect(); + EditorGUI.BeginDisabledGroup(p.xrRendering.boolValue); var guiContent = EditorGUI.BeginProperty(rect, FOVAxisModeContent, cam.fovAxisMode); EditorGUI.showMixedValue = cam.fovAxisMode.hasMultipleDifferentValues; @@ -285,6 +296,7 @@ static void Drawer_Projection(SerializedHDCamera p, Editor owner) : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect); } + EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); } } 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..97976116b80 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -1734,6 +1734,10 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c { var needCulling = true; + // In XR mode, sync the FOV on the camera to match the projection from the device in order to cull accurately + if (hdCamera.xr.enabled) + camera.fieldOfView = Mathf.Rad2Deg * Mathf.Atan(1.0f / hdCamera.xr.cullingParams.stereoProjectionMatrix.m00) * 2.0f; + // In XR multipass, culling results can be shared if the pass has the same culling id if (xrPass.multipassId > 0) {