Skip to content
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

[7.x.x Backport] Fix pre/post pass sg properties #82 #85

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.
Jump to
Jump to file
Failed to load files.
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 @@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Diffusion Profile and Material references in HDRP materials are now correctly exported to unity packages. Note that the diffusion profile or the material references need to be edited once before this can work properly.
- Fixed shadowmask UI now correctly showing shadowmask disable
- Fixed the indirect diffuse texture not being ignored when it should (ray tracing disabled).
- 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down