[unity] Corrected and unified Additive Slot behaviour of commit c5c7174 for URP and LWRP shaders (2D and 3D). Now only active for PMA blending and correctly performing alpha clip. See #1850.

This commit is contained in:
Harald Csaszar 2021-03-04 17:47:48 +01:00
parent 47e357aa88
commit d50cdef325
3 changed files with 4 additions and 12 deletions

View File

@ -212,11 +212,8 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
fixed4 texureColor = calculateTexturePixel(input.texcoord.xy);
RETURN_UNLIT_IF_ADDITIVE_SLOT(texureColor, input.vertexColor) // shall be called before ALPHA_CLIP
ALPHA_CLIP(texureColor, input.vertexColor)
#if !defined(_MULTIPLYBLEND) && !defined(_MULTIPLYBLEND_X2)
if (input.vertexColor.a == 0)
return texureColor * input.vertexColor;
#endif
// fill out InputData struct
InputData inputData;

View File

@ -87,12 +87,10 @@ VertexOutputSpriteURP2D CombinedShapeLightVertex(VertexInput input)
half4 CombinedShapeLightFragment(VertexOutputSpriteURP2D input) : SV_Target
{
fixed4 texureColor = calculateTexturePixel(input.texcoord.xy);
RETURN_UNLIT_IF_ADDITIVE_SLOT(texureColor, input.vertexColor) // shall be called before ALPHA_CLIP
ALPHA_CLIP(texureColor, input.vertexColor)
texureColor *= input.vertexColor;
#if !defined(_MULTIPLYBLEND) && !defined(_MULTIPLYBLEND_X2)
if (input.vertexColor.a == 0)
return texureColor;
#endif
half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, input.texcoord.xy);
half4 pixel = CombinedShapeLightShared(texureColor, mask, input.lightingUV);

View File

@ -222,11 +222,8 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
fixed4 texureColor = calculateTexturePixel(input.texcoord.xy);
RETURN_UNLIT_IF_ADDITIVE_SLOT(texureColor, input.vertexColor) // shall be called before ALPHA_CLIP
ALPHA_CLIP(texureColor, input.vertexColor)
#if !defined(_MULTIPLYBLEND) && !defined(_MULTIPLYBLEND_X2)
if (input.vertexColor.a == 0)
return texureColor * input.vertexColor;
#endif
// fill out InputData struct
InputData inputData;