浏览代码

Correct wrong define used in test + fix issue with transparent keyword not reset

/stochastic_alpha_test
Sebastien Lagarde 7 年前
当前提交
bd84a419
共有 3 个文件被更改,包括 9 次插入2 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
  2. 7
      ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/BaseUnlitUI.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/UnlitData.hlsl

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


// If we have a prepass, we need to remove the clip from the GBuffer pass (otherwise HiZ does not work on PS4)
// For Forward
// Opaque geometry always has a depth pre-pass so we never want to do the clip here. For transparent we perform the clip as usual.
#if !(SHADER_PASS == SHADERPASS_FORWARD && defined(SURFACE_TYPE_OPAQUE)) && !(SHADER_PASS == SHADERPASS_GBUFFER && defined(_BYPASS_ALPHA_TEST))
#if !(SHADERPASS == SHADERPASS_FORWARD && defined(SURFACE_TYPE_OPAQUE)) && !(SHADERPASS == SHADERPASS_GBUFFER && defined(_BYPASS_ALPHA_TEST))
clip(alpha - alphaCutoff);
#endif
}

7
ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/BaseUnlitUI.cs


SurfaceType surfaceType = (SurfaceType)material.GetFloat(kSurfaceType);
BlendMode blendMode = (BlendMode)material.GetFloat(kBlendMode);
// These need to always been set either with opaque or transparent! So a users can swtich to opaque and remove the keyword correctly
SetKeyword(material, "_BLENDMODE_LERP", false);
SetKeyword(material, "_BLENDMODE_ADD", false);
SetKeyword(material, "_BLENDMODE_SOFT_ADD", false);
SetKeyword(material, "_BLENDMODE_MULTIPLY", false);
SetKeyword(material, "_BLENDMODE_PRE_MULTIPLY", false);
if (surfaceType == SurfaceType.Opaque)
{
material.SetOverrideTag("RenderType", alphaTestEnable ? "TransparentCutout" : "");

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/UnlitData.hlsl


void DoAlphaTest(float alpha, float alphaCutoff)
{
// Don't do the clip when rendering forward opaque (unlit). Forward opaque always have a prepass (with depth test on)
#if !(SHADER_PASS == SHADERPASS_FORWARD_UNLIT && defined(SURFACE_TYPE_OPAQUE))
#if !(SHADERPASS == SHADERPASS_FORWARD_UNLIT && defined(SURFACE_TYPE_OPAQUE))
clip(alpha - alphaCutoff);
#endif
}

正在加载...
取消
保存