From fb88966ecbdbd83e2500884774a82a9888c31b54 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Thu, 9 Dec 2021 14:40:51 +0100 Subject: [PATCH 1/2] Backport 6519 --- .../Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs | 1 + .../Editor/RenderPipeline/HDRenderPipelineUI.cs | 1 + .../Editor/RenderPipeline/Settings/SerializedXRSettings.cs | 2 ++ .../Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs | 7 +++++++ .../Runtime/RenderPipeline/XR/GlobalXRSettings.cs | 5 ++++- 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index f618818ffc4..48f0e4ffbdb 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -256,6 +256,7 @@ public class Styles public static readonly GUIContent XRSinglePass = EditorGUIUtility.TrTextContent("Single Pass", "When enabled, XR views are rendered simultaneously and the render loop is processed only once. This setting will improve CPU and GPU performance but will use more GPU memory."); public static readonly GUIContent XROcclusionMesh = EditorGUIUtility.TrTextContent("Occlusion Mesh", "When enabled, the occlusion mesh will be rendered for each view during the depth prepass to reduce shaded fragments."); public static readonly GUIContent XRCameraJitter = EditorGUIUtility.TrTextContent("Camera Jitter", "When enabled, jitter will be added to the camera to provide more samples for temporal effects. This is usually not required in VR due to micro variations from the tracking."); + public static readonly GUIContent XRMotionBlur = EditorGUIUtility.TrTextContent("Allow Motion Blur", "When enabled, motion blur can be used in XR. When this option is disabled, regardless of the settings, motion blur will be turned off when in XR."); public static readonly GUIContent lutSize = EditorGUIUtility.TrTextContent("Grading LUT Size", "Sets size of the internal and external color grading lookup textures (LUTs)."); public static readonly GUIContent lutFormat = EditorGUIUtility.TrTextContent("Grading LUT Format", "Specifies the encoding format for color grading lookup textures. Lower precision formats are faster and use less memory at the expense of color precision."); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs index 732c43dadef..339b955b8dd 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs @@ -701,6 +701,7 @@ static void Drawer_SectionXRSettings(SerializedHDRenderPipelineAsset serialized, EditorGUILayout.PropertyField(serialized.renderPipelineSettings.xrSettings.singlePass, Styles.XRSinglePass); EditorGUILayout.PropertyField(serialized.renderPipelineSettings.xrSettings.occlusionMesh, Styles.XROcclusionMesh); EditorGUILayout.PropertyField(serialized.renderPipelineSettings.xrSettings.cameraJitter, Styles.XRCameraJitter); + EditorGUILayout.PropertyField(serialized.renderPipelineSettings.xrSettings.allowMotionBlur, Styles.XRMotionBlur); } static void Drawer_SectionVTSettings(SerializedHDRenderPipelineAsset serialized, Editor owner) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedXRSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedXRSettings.cs index 4a462298ef0..b94bc038312 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedXRSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedXRSettings.cs @@ -9,6 +9,7 @@ class SerializedXRSettings public SerializedProperty singlePass; public SerializedProperty occlusionMesh; public SerializedProperty cameraJitter; + public SerializedProperty allowMotionBlur; public SerializedXRSettings(SerializedProperty root) { @@ -17,6 +18,7 @@ public SerializedXRSettings(SerializedProperty root) singlePass = root.Find((GlobalXRSettings s) => s.singlePass); occlusionMesh = root.Find((GlobalXRSettings s) => s.occlusionMesh); cameraJitter = root.Find((GlobalXRSettings s) => s.cameraJitter); + allowMotionBlur = root.Find((GlobalXRSettings s) => s.allowMotionBlur); } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 46b43e12b80..40b9ca2c8ac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -3639,6 +3639,13 @@ TextureHandle MotionBlurPass(RenderGraph renderGraph, HDCamera hdCamera, Texture { if (m_MotionBlur.IsActive() && m_AnimatedMaterialsEnabled && !hdCamera.resetPostProcessingHistory && m_MotionBlurFS) { + // If we are in XR we need to check if motion blur is allowed at all. + if (hdCamera.xr.enabled) + { + if (!m_Asset.currentPlatformRenderPipelineSettings.xrSettings.allowMotionBlur) + return source; + } + using (var builder = renderGraph.AddRenderPass("Motion Blur", out var passData, ProfilingSampler.Get(HDProfileId.MotionBlur))) { PrepareMotionBlurPassData(renderGraph, builder, passData, hdCamera, source, motionVectors, depthTexture); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/GlobalXRSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/GlobalXRSettings.cs index 07e631a68b6..5395ab1fe56 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/GlobalXRSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/GlobalXRSettings.cs @@ -12,7 +12,8 @@ public struct GlobalXRSettings { singlePass = true, occlusionMesh = true, - cameraJitter = false + cameraJitter = false, + allowMotionBlur = true }; /// Use single pass. @@ -21,5 +22,7 @@ public struct GlobalXRSettings public bool occlusionMesh; /// Add jitter to camera for temporal effects. public bool cameraJitter; + /// Allow motion blur when in XR. + public bool allowMotionBlur; } } From c49666f40c49b8ec4563e24d5f2c8bae7f5c70d3 Mon Sep 17 00:00:00 2001 From: FrancescoC-Unity Date: Thu, 9 Dec 2021 16:10:27 +0100 Subject: [PATCH 2/2] Changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index fdfe11f78e1..2527e327d4d 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed missing information in the tooltip of affects smooth surfaces of the ray traced reflections denoiser (case 1376918). - Fixed objects belonging to preview scenes being marked as dirty during migration (case 1367204). - Fixed compilation errors from Path Tracing on the PS5 build. +- Fixed option to force motion blur off when in XR. ## [12.1.2] - 2021-10-22