-
Notifications
You must be signed in to change notification settings - Fork 0
/
Alpha.shader
65 lines (56 loc) · 1.06 KB
/
Alpha.shader
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
Shader "Lean/Common/Alpha"
{
Properties
{
_MainTex("Main Tex", 2D) = "white" {}
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"PreviewType" = "Sphere"
"DisableBatching" = "True"
}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Pass
{
CGPROGRAM
#pragma vertex Vert
#pragma fragment Frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _Color;
struct a2v
{
float4 vertex : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 color : COLOR;
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
struct f2g
{
float4 color : SV_TARGET;
};
void Vert(a2v i, out v2f o)
{
o.vertex = UnityObjectToClipPos(i.vertex);
o.uv = TRANSFORM_TEX(i.texcoord0, _MainTex);
o.color = i.color * _Color;
}
void Frag(v2f i, out f2g o)
{
o.color = tex2D(_MainTex, i.uv) * i.color;
}
ENDCG
} // Pass
} // SubShader
} // Shader