lcy
2025-01-02 c867ea92cce28ea0ceb312ef8e2f8e7e0888b1d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
 
Shader "Effect/Mask/Alpha Blended Tint"
{
    Properties
    {
        _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
        _MainTex ("Particle Texture", 2D) = "white" {}
        _Mask ("Mask", 2D) = "white" {}
 
        _Stencil("Stencil ID",float)=0
        _StencilComp("Stencil Comp",float)=8
    }
    SubShader
    {
        Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
        Blend SrcAlpha OneMinusSrcAlpha
//         AlphaTest Greater .01
//         ColorMask RGB
        Cull Off Lighting Off ZWrite Off Fog { Color (0,0,0,0) }
 
        Stencil{
            Ref [_Stencil]
            Comp [_StencilComp]
        }
 
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            
            #include "UnityCG.cginc"
 
            struct appdata
            {
                float4 vertex : POSITION;
                half2 uv : TEXCOORD0;
                fixed4 color : COLOR;
            };
 
            struct v2f
            {
                float4 vertex : SV_POSITION;
                half4 uv : TEXCOORD0;
                fixed4 color : TEXCOORD1;
            };
 
            half4 _MainTex_ST;
            half4 _Mask_ST;
            
            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = half4(TRANSFORM_TEX(v.uv, _MainTex), TRANSFORM_TEX(v.uv, _Mask));
                o.color = v.color;
                return o;
            }
 
            sampler2D _MainTex;
            sampler2D _Mask;
            fixed4 _TintColor;
            
            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 color = _TintColor * i.color;
 
                fixed4 maskColor = tex2D(_Mask, i.uv.zw);
                color = maskColor * color;
 
                fixed4 mainColor = tex2D(_MainTex, i.uv.xy);
                color = mainColor * color * 2;
        
                return color;
            }
            ENDCG
        }
    }
}