diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index fd32fbcb022..1e7f2414d60 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed scalarization code for contact shadows - Fix MaterialBalls having same guid issue - Fix spelling and grammatical errors in material samples +- Fixed depth prepass and postpass being disabled after changing the shader in the material UI. ### Changed - Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history. diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeGUI.cs index 083a42d386d..d3070c798a7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeGUI.cs @@ -14,7 +14,8 @@ class EyeGUI : HDShaderGUI // For surface option shader graph we only want all unlit features but alpha clip, back then front rendering and SSR const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit ^ SurfaceOptionUIBlock.Features.AlphaCutoffThreshold - ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass; + ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass + ^ SurfaceOptionUIBlock.Features.ShowPrePassAndPostPass; MaterialUIBlockList uiBlocks = new MaterialUIBlockList { diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs index db67c7bdc70..bc1fca3d904 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeMasterNode.cs @@ -783,6 +783,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera ); HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, alphaTest.isOn, false); HDSubShaderUtilities.AddDoubleSidedProperty(collector, doubleSidedMode); + HDSubShaderUtilities.AddPrePostPassProperties(collector, alphaTestDepthPrepass.isOn, alphaTestDepthPostpass.isOn); base.CollectShaderProperties(collector, generationMode); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricGUI.cs index adf7cf976e7..f94a62156f2 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricGUI.cs @@ -15,7 +15,8 @@ class FabricGUI : HDShaderGUI const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit ^ SurfaceOptionUIBlock.Features.AlphaCutoffThreshold ^ SurfaceOptionUIBlock.Features.BackThenFrontRendering - ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass; + ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass + ^ SurfaceOptionUIBlock.Features.ShowPrePassAndPostPass; MaterialUIBlockList uiBlocks = new MaterialUIBlockList { diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs index dcdbacbe89f..070f81ac458 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricMasterNode.cs @@ -794,6 +794,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera ); HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, alphaTest.isOn, false); HDSubShaderUtilities.AddDoubleSidedProperty(collector, doubleSidedMode); + HDSubShaderUtilities.AddPrePostPassProperties(collector, false, false); base.CollectShaderProperties(collector, generationMode); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairGUI.cs index fefeb3f5b21..e354ec5f0c0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairGUI.cs @@ -15,7 +15,8 @@ class HairGUI : HDShaderGUI const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit ^ SurfaceOptionUIBlock.Features.AlphaCutoffThreshold ^ SurfaceOptionUIBlock.Features.BackThenFrontRendering - ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass; + ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass + ^ SurfaceOptionUIBlock.Features.ShowPrePassAndPostPass; MaterialUIBlockList uiBlocks = new MaterialUIBlockList { diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs index 9d7c6df5740..700b2149105 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairMasterNode.cs @@ -899,6 +899,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera ); HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, alphaTest.isOn, alphaTestShadow.isOn); HDSubShaderUtilities.AddDoubleSidedProperty(collector, doubleSidedMode); + HDSubShaderUtilities.AddPrePostPassProperties(collector, alphaTestDepthPrepass.isOn, alphaTestDepthPostpass.isOn); base.CollectShaderProperties(collector, generationMode); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitGUI.cs index f0f3d03b87d..e41bc36ed26 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitGUI.cs @@ -15,7 +15,8 @@ class HDLitGUI : HDShaderGUI const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit ^ SurfaceOptionUIBlock.Features.AlphaCutoffThreshold ^ SurfaceOptionUIBlock.Features.BackThenFrontRendering - ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass; + ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass + ^ SurfaceOptionUIBlock.Features.ShowPrePassAndPostPass; MaterialUIBlockList uiBlocks = new MaterialUIBlockList { diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs index 4a416f917a6..e5062d7e708 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitMasterNode.cs @@ -1119,6 +1119,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera ); HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, alphaTest.isOn, alphaTestShadow.isOn); HDSubShaderUtilities.AddDoubleSidedProperty(collector, doubleSidedMode); + HDSubShaderUtilities.AddPrePostPassProperties(collector, alphaTestDepthPrepass.isOn, alphaTestDepthPostpass.isOn); base.CollectShaderProperties(collector, generationMode); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitGUI.cs index dba83b9b46a..aec2a60c1b8 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitGUI.cs @@ -15,7 +15,8 @@ class StackLitGUI : HDShaderGUI const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit ^ SurfaceOptionUIBlock.Features.AlphaCutoffThreshold ^ SurfaceOptionUIBlock.Features.BackThenFrontRendering - ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass; + ^ SurfaceOptionUIBlock.Features.ShowAfterPostProcessPass + ^ SurfaceOptionUIBlock.Features.ShowPrePassAndPostPass; MaterialUIBlockList uiBlocks = new MaterialUIBlockList { diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs index 5a26461c754..6a212a98848 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitMasterNode.cs @@ -1424,6 +1424,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera ); HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, alphaTest.isOn, false); HDSubShaderUtilities.AddDoubleSidedProperty(collector, doubleSidedMode); + HDSubShaderUtilities.AddPrePostPassProperties(collector, false, false); base.CollectShaderProperties(collector, generationMode); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/SurfaceOptionUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/SurfaceOptionUIBlock.cs index 053bac86cbd..86bc32c050e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/SurfaceOptionUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/SurfaceOptionUIBlock.cs @@ -26,6 +26,7 @@ public enum Features ReceiveSSR = 1 << 8, ShowAfterPostProcessPass = 1 << 9, Unlit = Surface | BlendMode | DoubleSided | DoubleSidedNormalMode | AlphaCutoff | AlphaCutoffShadowThreshold | AlphaCutoffThreshold | BackThenFrontRendering | ShowAfterPostProcessPass, + ShowPrePassAndPostPass = 1 << 11, Lit = All, All = ~0, } @@ -483,11 +484,14 @@ void DrawSurfaceGUI() if (transparentBackfaceEnable != null) materialEditor.ShaderProperty(transparentBackfaceEnable, Styles.transparentBackfaceEnableText); - if (transparentDepthPrepassEnable != null) - materialEditor.ShaderProperty(transparentDepthPrepassEnable, Styles.transparentDepthPrepassEnableText); + if ((m_Features & Features.ShowPrePassAndPostPass) != 0) + { + if (transparentDepthPrepassEnable != null) + materialEditor.ShaderProperty(transparentDepthPrepassEnable, Styles.transparentDepthPrepassEnableText); - if (transparentDepthPostpassEnable != null) - materialEditor.ShaderProperty(transparentDepthPostpassEnable, Styles.transparentDepthPostpassEnableText); + if (transparentDepthPostpassEnable != null) + materialEditor.ShaderProperty(transparentDepthPostpassEnable, Styles.transparentDepthPostpassEnableText); + } if (transparentWritingMotionVec != null) materialEditor.ShaderProperty(transparentWritingMotionVec, Styles.transparentWritingMotionVecText); diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/HDShaderGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/HDShaderGUI.cs index 0c887989336..01994b5ccc1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/HDShaderGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/HDShaderGUI.cs @@ -90,7 +90,8 @@ protected static void ResetMaterialCustomRenderQueue(Material material) } readonly static string[] floatPropertiesToSynchronize = { - "_UseShadowThreshold", kReceivesSSR, kUseSplitLighting + "_UseShadowThreshold", kReceivesSSR, kUseSplitLighting, + kTransparentDepthPrepassEnable, kTransparentDepthPostpassEnable }; protected static void SynchronizeShaderGraphProperties(Material material) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitGUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitGUI.cs index a3f577a6075..9d91aadf2a9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitGUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitGUI.cs @@ -16,7 +16,8 @@ class HDUnlitGUI : HDShaderGUI const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit ^ SurfaceOptionUIBlock.Features.AlphaCutoffThreshold ^ SurfaceOptionUIBlock.Features.DoubleSidedNormalMode - ^ SurfaceOptionUIBlock.Features.BackThenFrontRendering; + ^ SurfaceOptionUIBlock.Features.BackThenFrontRendering + ^ SurfaceOptionUIBlock.Features.ShowPrePassAndPostPass; MaterialUIBlockList uiBlocks = new MaterialUIBlockList { diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs index 796960e98f0..3ad1dc98b42 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitMasterNode.cs @@ -495,6 +495,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera ); HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, alphaTest.isOn, false); HDSubShaderUtilities.AddDoubleSidedProperty(collector, doubleSided.isOn ? DoubleSidedMode.Enabled : DoubleSidedMode.Disabled); + HDSubShaderUtilities.AddPrePostPassProperties(collector, false, false); base.CollectShaderProperties(collector, generationMode); } diff --git a/com.unity.render-pipelines.high-definition/Editor/ShaderGraph/HDSubShaderUtilities.cs b/com.unity.render-pipelines.high-definition/Editor/ShaderGraph/HDSubShaderUtilities.cs index dd362a78cfa..e3e2f90883d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/ShaderGraph/HDSubShaderUtilities.cs +++ b/com.unity.render-pipelines.high-definition/Editor/ShaderGraph/HDSubShaderUtilities.cs @@ -1336,6 +1336,12 @@ public static void AddDoubleSidedProperty(PropertyCollector collector, DoubleSid }); } + public static void AddPrePostPassProperties(PropertyCollector collector, bool prepass, bool postpass) + { + collector.AddToggleProperty(kTransparentDepthPrepassEnable, prepass); + collector.AddToggleProperty(kTransparentDepthPostpassEnable, postpass); + } + public static string RenderQueueName(HDRenderQueue.RenderQueueType value) { switch (value)