Skip to content

Hdrp/fix/custom pass msaa rendering info #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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 =
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down