|
@@ -1,7 +1,7 @@
|
|
// Spine/Skeleton Tint
|
|
// Spine/Skeleton Tint
|
|
// - Two color tint
|
|
// - Two color tint
|
|
// - unlit
|
|
// - unlit
|
|
-// - Premultiplied alpha blending
|
|
|
|
|
|
+// - Premultiplied alpha blending (Optional straight alpha input)
|
|
// - No depth, no backface culling, no fog.
|
|
// - No depth, no backface culling, no fog.
|
|
|
|
|
|
Shader "Spine/Skeleton Tint" {
|
|
Shader "Spine/Skeleton Tint" {
|
|
@@ -9,6 +9,7 @@ Shader "Spine/Skeleton Tint" {
|
|
_Color ("Tint Color", Color) = (1,1,1,1)
|
|
_Color ("Tint Color", Color) = (1,1,1,1)
|
|
_Black ("Black Point", Color) = (0,0,0,0)
|
|
_Black ("Black Point", Color) = (0,0,0,0)
|
|
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
|
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
|
|
|
|
+ [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
|
}
|
|
}
|
|
|
|
|
|
@@ -23,6 +24,7 @@ Shader "Spine/Skeleton Tint" {
|
|
|
|
|
|
Pass {
|
|
Pass {
|
|
CGPROGRAM
|
|
CGPROGRAM
|
|
|
|
+ #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
|
#pragma vertex vert
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
#include "UnityCG.cginc"
|
|
@@ -44,7 +46,7 @@ Shader "Spine/Skeleton Tint" {
|
|
|
|
|
|
VertexOutput vert (VertexInput v) {
|
|
VertexOutput vert (VertexInput v) {
|
|
VertexOutput o;
|
|
VertexOutput o;
|
|
- o.pos = UnityObjectToClipPos(v.vertex); // replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
|
|
|
|
+ o.pos = UnityObjectToClipPos(v.vertex);
|
|
o.uv = v.uv;
|
|
o.uv = v.uv;
|
|
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
|
o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
|
|
return o;
|
|
return o;
|
|
@@ -52,6 +54,11 @@ Shader "Spine/Skeleton Tint" {
|
|
|
|
|
|
float4 frag (VertexOutput i) : COLOR {
|
|
float4 frag (VertexOutput i) : COLOR {
|
|
float4 texColor = tex2D(_MainTex, i.uv);
|
|
float4 texColor = tex2D(_MainTex, i.uv);
|
|
|
|
+
|
|
|
|
+ #if defined(_STRAIGHT_ALPHA_INPUT)
|
|
|
|
+ texColor.rgb *= texColor.a;
|
|
|
|
+ #endif
|
|
|
|
+
|
|
return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * _Black.rgb * texColor.a*_Color.a*i.vertexColor.a), 0);
|
|
return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * _Black.rgb * texColor.a*_Color.a*i.vertexColor.a), 0);
|
|
}
|
|
}
|
|
ENDCG
|
|
ENDCG
|