diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Fill.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Fill.shader index 12001cd57d..ad23205d6d 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Fill.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Fill.shader @@ -91,19 +91,20 @@ Shader "Spine/Skeleton Fill" { struct VertexOutput { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; - VertexOutput vert (appdata_base v) { + VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) { VertexOutput o; - o.uv = v.texcoord; + o.uvAndAlpha = v.texcoord; + o.uvAndAlpha.a = vertexColor.a; TRANSFER_SHADOW_CASTER(o) return o; } float4 frag (VertexOutput i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Tint.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Tint.shader index 638e09c6f0..1f639c56f4 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Tint.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Skeleton-Tint.shader @@ -94,19 +94,20 @@ Shader "Spine/Skeleton Tint" { struct VertexOutput { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; - VertexOutput vert (appdata_base v) { + VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) { VertexOutput o; - o.uv = v.texcoord; + o.uvAndAlpha = v.texcoord; + o.uvAndAlpha.a = vertexColor.a; TRANSFER_SHADOW_CASTER(o) return o; } float4 frag (VertexOutput i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Special-Skeleton-Grayscale.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Special-Skeleton-Grayscale.shader index 80f30d38aa..95d54b7b65 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Special-Skeleton-Grayscale.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Spine-Special-Skeleton-Grayscale.shader @@ -91,19 +91,20 @@ Shader "Spine/Special/Skeleton Grayscale" { struct VertexOutput { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; - VertexOutput vert (appdata_base v) { + VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) { VertexOutput o; - o.uv = v.texcoord; + o.uvAndAlpha = v.texcoord; + o.uvAndAlpha.a = vertexColor.a; TRANSFER_SHADOW_CASTER(o) return o; } float4 frag (VertexOutput i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/CGIncludes/SpriteShadows.cginc b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/CGIncludes/SpriteShadows.cginc index a24df47e38..8e93d3eb35 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/CGIncludes/SpriteShadows.cginc +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/CGIncludes/SpriteShadows.cginc @@ -16,18 +16,20 @@ struct vertexInput struct vertexOutput { V2F_SHADOW_CASTER; - float2 texcoord : TEXCOORD1; + float4 texcoordAndAlpha : TEXCOORD1; }; //////////////////////////////////////// // Vertex program // -vertexOutput vert(vertexInput v) +vertexOutput vert(vertexInput v, float4 vertexColor : COLOR) { vertexOutput o; TRANSFER_SHADOW_CASTER(o) - o.texcoord = calculateTextureCoord(v.texcoord); + o.texcoordAndAlpha.xy = calculateTextureCoord(v.texcoord); + o.texcoordAndAlpha.z = 0; + o.texcoordAndAlpha.a = vertexColor.a; return o; } @@ -40,8 +42,8 @@ uniform fixed _ShadowAlphaCutoff; fixed4 frag(vertexOutput IN) : COLOR { - fixed4 texureColor = calculateTexturePixel(IN.texcoord); - clip(texureColor.a - _ShadowAlphaCutoff); + fixed4 texureColor = calculateTexturePixel(IN.texcoordAndAlpha.xy); + clip(texureColor.a * IN.texcoordAndAlpha.a - _ShadowAlphaCutoff); SHADOW_CASTER_FRAGMENT(IN) } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpriteShadows.cginc b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpriteShadows.cginc index 6b88c198f5..6839573f57 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpriteShadows.cginc +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpriteShadows.cginc @@ -16,7 +16,7 @@ struct vertexInput struct vertexOutput { V2F_SHADOW_CASTER; - float4 texcoord : TEXCOORD1; + float4 texcoordAndAlpha : TEXCOORD1; }; //////////////////////////////////////// @@ -26,11 +26,13 @@ struct vertexOutput uniform sampler2D _MainTex; uniform fixed4 _MainTex_ST; -vertexOutput vert(vertexInput v) +vertexOutput vert(vertexInput v, float4 vertexColor : COLOR) { vertexOutput o; TRANSFER_SHADOW_CASTER(o) - o.texcoord = float4(TRANSFORM_TEX(v.texcoord, _MainTex), 0, 0); + o.texcoordAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.texcoordAndAlpha.z = 0; + o.texcoordAndAlpha.a = vertexColor.a; return o; } @@ -43,8 +45,8 @@ uniform fixed _ShadowAlphaCutoff; fixed4 frag(vertexOutput IN) : COLOR { - fixed4 texureColor = tex2D(_MainTex, IN.texcoord.xy); - clip(texureColor.a - _ShadowAlphaCutoff); + fixed4 texureColor = tex2D(_MainTex, IN.texcoordAndAlpha.xy); + clip(texureColor.a * IN.texcoordAndAlpha.a - _ShadowAlphaCutoff); SHADOW_CASTER_FRAGMENT(IN) } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpritesUnlit.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpritesUnlit.shader index 56521c4ee3..3377d2aa57 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpritesUnlit.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Shaders/Sprite/SpritesUnlit.shader @@ -80,7 +80,7 @@ Shader "Spine/Sprite/Unlit" Cull Off Lighting Off - CGPROGRAM + CGPROGRAM #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile_shadowcaster #pragma multi_compile _ PIXELSNAP_ON diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader index 0b79b53642..58b0fed7bd 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Additive.shader @@ -88,15 +88,17 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" { #include "UnityCG.cginc" struct v2f { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; uniform float4 _MainTex_ST; - v2f vert (appdata_base v) { + v2f vert (appdata_base v, float4 vertexColor : COLOR) { v2f o; TRANSFER_SHADOW_CASTER(o) - o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.z = 0; + o.uvAndAlpha.a = vertexColor.a; return o; } @@ -104,8 +106,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" { uniform fixed _Cutoff; float4 frag (v2f i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader index 3d16848c69..c5f7758964 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Multiply.shader @@ -88,15 +88,17 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { #include "UnityCG.cginc" struct v2f { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; uniform float4 _MainTex_ST; - v2f vert (appdata_base v) { + v2f vert (appdata_base v, float4 vertexColor : COLOR) { v2f o; TRANSFER_SHADOW_CASTER(o) - o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.z = 0; + o.uvAndAlpha.a = vertexColor.a; return o; } @@ -104,8 +106,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" { uniform fixed _Cutoff; float4 frag (v2f i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader index 1a1dfbf1c1..13ffe67c99 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/BlendModes/Spine-Skeleton-PMA-Screen.shader @@ -88,15 +88,17 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" { #include "UnityCG.cginc" struct v2f { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; uniform float4 _MainTex_ST; - v2f vert (appdata_base v) { + v2f vert (appdata_base v, float4 vertexColor : COLOR) { v2f o; TRANSFER_SHADOW_CASTER(o) - o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.z = 0; + o.uvAndAlpha.a = vertexColor.a; return o; } @@ -104,8 +106,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" { uniform fixed _Cutoff; float4 frag (v2f i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader index f67810e528..ce7a10ce6c 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton-TintBlack.shader @@ -100,19 +100,20 @@ Shader "Spine/Skeleton Tint Black" { struct v2f { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; - v2f vert (appdata_base v) { + v2f vert (appdata_base v, float4 vertexColor : COLOR) { v2f o; TRANSFER_SHADOW_CASTER(o) - o.uv = v.texcoord; + o.uvAndAlpha = v.texcoord; + o.uvAndAlpha.a = vertexColor.a; return o; } float4 frag (v2f i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader index 3050d089ca..d0f0b2885b 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-Skeleton.shader @@ -84,19 +84,20 @@ Shader "Spine/Skeleton" { struct VertexOutput { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; - VertexOutput vert (appdata_base v) { + VertexOutput vert (appdata_base v, float4 vertexColor : COLOR) { VertexOutput o; - o.uv = v.texcoord; + o.uvAndAlpha = v.texcoord; + o.uvAndAlpha.a = vertexColor.a; TRANSFER_SHADOW_CASTER(o) return o; } float4 frag (VertexOutput i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-SkeletonLit.shader b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-SkeletonLit.shader index 228a41566d..75ec15bc4d 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-SkeletonLit.shader +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Shaders/Spine-SkeletonLit.shader @@ -179,15 +179,17 @@ Shader "Spine/Skeleton Lit" { #include "UnityCG.cginc" struct v2f { V2F_SHADOW_CASTER; - float2 uv : TEXCOORD1; + float4 uvAndAlpha : TEXCOORD1; }; uniform float4 _MainTex_ST; - v2f vert (appdata_base v) { + v2f vert (appdata_base v, float4 vertexColor : COLOR) { v2f o; TRANSFER_SHADOW_CASTER(o) - o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uvAndAlpha.z = 0; + o.uvAndAlpha.a = vertexColor.a; return o; } @@ -195,8 +197,8 @@ Shader "Spine/Skeleton Lit" { uniform fixed _Cutoff; float4 frag (v2f i) : COLOR { - fixed4 texcol = tex2D(_MainTex, i.uv); - clip(texcol.a - _Cutoff); + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a * i.uvAndAlpha.a - _Cutoff); SHADOW_CASTER_FRAGMENT(i) } ENDCG