mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[unity] SkeletonTint does black point tinting through a material property.
This commit is contained in:
parent
ee1028bb13
commit
ec36a1d6ec
@ -1,6 +1,13 @@
|
||||
// Spine/Skeleton Tint
|
||||
// - Two color tint
|
||||
// - unlit
|
||||
// - Premultiplied alpha blending
|
||||
// - No depth, no backface culling, no fog.
|
||||
|
||||
Shader "Spine/Skeleton Tint" {
|
||||
Properties {
|
||||
_Color ("Tint Color", Color) = (1,1,1,1)
|
||||
_Black ("Black Point", Color) = (0,0,0,0)
|
||||
_MainTex ("MainTex", 2D) = "black" {}
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
}
|
||||
@ -23,6 +30,7 @@ Shader "Spine/Skeleton Tint" {
|
||||
#include "UnityCG.cginc"
|
||||
uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
|
||||
uniform float4 _Color;
|
||||
uniform float4 _Black;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
@ -45,7 +53,8 @@ Shader "Spine/Skeleton Tint" {
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i) : COLOR {
|
||||
return (tex2D(_MainTex, i.uv) * i.vertexColor);
|
||||
float4 texColor = tex2D(_MainTex, i.uv);
|
||||
return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * texColor.a * _Black.rgb), 0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user