Procházet zdrojové kódy

[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.

Harald Csaszar před 4 roky
rodič
revize
d50cdef325

+ 1 - 4
spine-unity/Modules/com.esotericsoftware.spine.lwrp-shaders/Shaders/CGIncludes/Spine-Sprite-ForwardPass-LW.hlsl

@@ -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;

+ 2 - 4
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-Sprite-StandardPass-URP-2D.hlsl

@@ -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);

+ 1 - 4
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-ForwardPass-URP.hlsl

@@ -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;