[unity] Fixed URP/2D/Skeleton Lit shader incorrectly displaying Additive slots. Closes #2533.

This commit is contained in:
Harald Csaszar 2024-05-23 14:44:45 +02:00
parent 986e061272
commit 986ab71c66
2 changed files with 7 additions and 7 deletions

View File

@ -141,18 +141,18 @@ Shader "Universal Render Pipeline/2D/Spine/Skeleton Lit" {
// un-premultiply for additive lights in CombinedShapeLightShared, reapply afterwards // un-premultiply for additive lights in CombinedShapeLightShared, reapply afterwards
main.rgb = main.a == 0 ? main.rgb : main.rgb / main.a; main.rgb = main.a == 0 ? main.rgb : main.rgb / main.a;
#else #else
#if !defined(_LIGHT_AFFECTS_ADDITIVE)
if (i.color.a == 0) {
return tex * i.color; // unlit additive, directly return PMA color
}
#endif
#if !defined(_STRAIGHT_ALPHA_INPUT) #if !defined(_STRAIGHT_ALPHA_INPUT)
// un-premultiply for additive lights in CombinedShapeLightShared, reapply afterwards // un-premultiply for additive lights in CombinedShapeLightShared, reapply afterwards
tex.rgb = tex.a == 0 ? tex.rgb : tex.rgb / tex.a; tex.rgb = tex.a == 0 ? tex.rgb : tex.rgb / tex.a;
#endif #endif
half4 main = tex * i.color; half4 main = tex * i.color;
#if !defined(_LIGHT_AFFECTS_ADDITIVE)
if (i.color.a == 0)
return half4(main.rgb * main.a, main.a);
#endif
#endif #endif
half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv);
#if UNITY_VERSION < 202120 #if UNITY_VERSION < 202120
return half4(CombinedShapeLightShared(half4(main.rgb, 1), mask, i.lightingUV).rgb * main.a, main.a); return half4(CombinedShapeLightShared(half4(main.rgb, 1), mask, i.lightingUV).rgb * main.a, main.a);

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.urp-shaders", "name": "com.esotericsoftware.spine.urp-shaders",
"displayName": "Spine Universal RP Shaders", "displayName": "Spine Universal RP Shaders",
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", "description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.2.31", "version": "4.2.32",
"unity": "2019.3", "unity": "2019.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",