diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 17598262317..6a6818f871a 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added option to disable XR rendering on the camera settings. - Added support for specular AA from geometric curvature in AxF - Added support for baked AO (no input for now) in AxF +- Added an info box to warn about depth test artifacts when rendering object twice in custom passes with MSAA. ### Fixed - Fix when rescale probe all direction below zero (1219246) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs index 63d835a7615..0d28dd585c9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs @@ -56,10 +56,11 @@ private class Styles public static string unlitShaderMessage = "HDRP Unlit shaders will force the shader passes to \"ForwardOnly\""; public static string hdrpLitShaderMessage = "HDRP Lit shaders are not supported in a custom pass"; public static string opaqueObjectWithDeferred = "Your HDRP settings does not support ForwardOnly, some object might not render."; + public static string objectRendererTwiceWithMSAA = "MSAA is enabled, re-rendering same object twice will cause depth test artifacts in Before/After Post Process injection points"; } //Headers and layout - private int m_FilterLines = 3; + private int m_FilterLines = 2; private int m_MaterialLines = 2; // Foldouts @@ -86,6 +87,8 @@ private class Styles ReorderableList m_ShaderPassesList; + CustomPassVolume m_Volume; + bool customDepthIsNone => (CustomPass.TargetBuffer)m_TargetDepthBuffer.intValue == CustomPass.TargetBuffer.None; protected override void Initialize(SerializedProperty customPass) @@ -112,6 +115,8 @@ protected override void Initialize(SerializedProperty customPass) m_DepthCompareFunction = customPass.FindPropertyRelative("depthCompareFunction"); m_DepthWrite = customPass.FindPropertyRelative("depthWrite"); + m_Volume = customPass.serializedObject.targetObject as CustomPassVolume; + m_ShaderPassesList = new ReorderableList(null, m_ShaderPasses, true, true, true, true); m_ShaderPassesList.drawElementCallback = @@ -132,6 +137,14 @@ protected override void Initialize(SerializedProperty customPass) protected override void DoPassGUI(SerializedProperty customPass, Rect rect) { + if (ShowMsaaObjectInfo()) + { + Rect helpBoxRect = rect; + helpBoxRect.height = Styles.helpBoxHeight; + EditorGUI.HelpBox(helpBoxRect, Styles.objectRendererTwiceWithMSAA, MessageType.Info); + rect.y += Styles.helpBoxHeight; + } + DoFilters(ref rect); m_RendererFoldout.boolValue = EditorGUI.Foldout(rect, m_RendererFoldout.boolValue, Styles.renderHeader, true); @@ -156,7 +169,7 @@ protected override void DoPassGUI(SerializedProperty customPass, Rect rect) } } - // Tel if we need to show a warning for rendering opaque object and we're in deferred. + // Tell if we need to show a warning for rendering opaque object and we're in deferred. bool ShowOpaqueObjectWarning() { // Only opaque objects are concerned @@ -173,6 +186,18 @@ bool ShowOpaqueObjectWarning() return true; } + // Tell if we need to show the MSAA message info + bool ShowMsaaObjectInfo() + { + if (!HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.supportMSAA) + return false; + + if (m_Volume.injectionPoint != CustomPassInjectionPoint.AfterPostProcess && m_Volume.injectionPoint != CustomPassInjectionPoint.BeforePostProcess) + return false; + + return true; + } + void DoFilters(ref Rect rect) { m_FilterFoldout.boolValue = EditorGUI.Foldout(rect, m_FilterFoldout.boolValue, Styles.filtersHeader, true); @@ -296,9 +321,11 @@ protected override float GetPassHeight(SerializedProperty customPass) { float height = Styles.defaultLineSpace; + height += ShowMsaaObjectInfo() ? Styles.helpBoxHeight : 0; + if (m_FilterFoldout.boolValue) { - height *= m_FilterLines; + height += Styles.defaultLineSpace * m_FilterLines; height += ShowOpaqueObjectWarning() ? Styles.helpBoxHeight : 0; }