-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToonXRayColor.shader
134 lines (115 loc) · 3.67 KB
/
ToonXRayColor.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "XRayColor"
{
Properties
{
[MaterialToggle(_TEX_ON)] _DetailTex ("Enable Detail texture", Float) = 0 //1
_MainTex ("Detail", 2D) = "white" {} //2
_ToonShade ("Shade", 2D) = "white" {} //3
[MaterialToggle(_COLOR_ON)] _TintColor ("Enable Color Tint", Float) = 0 //4
_Color ("Base Color", Color) = (1,1,1,1) //5
[MaterialToggle(_VCOLOR_ON)] _VertexColor ("Enable Vertex Color", Float) = 0//6
_Brightness ("Brightness 1 = neutral", Float) = 1.0 //7
_Alpha ("Alpha", Float) = 0.3 //8
}
Subshader
{
Tags { "RenderType"="Opaque" }
LOD 250
ZWrite On
Cull Back
Lighting Off
Fog { Mode Off }
Pass
{
Blend SrcAlpha One
ZWrite Off
ZTest Greater
CGPROGRAM
#include "Lighting.cginc"
float _Alpha;
struct v2f
{
float4 pos : SV_POSITION;
};
v2f vert (appdata_base v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
return fixed4(1,1,1,_Alpha);
}
#pragma vertex vert
#pragma fragment frag
ENDCG
}
Pass
{
Name "BASE"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#pragma glsl_no_auto_normalization
#pragma multi_compile _TEX_OFF _TEX_ON
#pragma multi_compile _COLOR_OFF _COLOR_ON
#if _TEX_ON
sampler2D _MainTex;
half4 _MainTex_ST;
#endif
struct appdata_base0
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 texcoord : TEXCOORD0;
};
struct v2f
{
float4 pos : SV_POSITION;
#if _TEX_ON
half2 uv : TEXCOORD0;
#endif
half2 uvn : TEXCOORD1;
};
v2f vert (appdata_base0 v)
{
v2f o;
o.pos = UnityObjectToClipPos ( v.vertex );
float3 n = mul((float3x3)UNITY_MATRIX_IT_MV, normalize(v.normal));
normalize(n);
n = n * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
o.uvn = n.xy;
#if _TEX_ON
o.uv = TRANSFORM_TEX ( v.texcoord, _MainTex );
#endif
return o;
}
sampler2D _ToonShade;
fixed _Brightness;
#if _COLOR_ON
fixed4 _Color;
#endif
fixed4 frag (v2f i) : COLOR
{
#if _COLOR_ON
fixed4 toonShade = tex2D( _ToonShade, i.uvn )*_Color;
#else
fixed4 toonShade = tex2D( _ToonShade, i.uvn );
#endif
#if _TEX_ON
fixed4 detail = tex2D ( _MainTex, i.uv );
return toonShade * detail*_Brightness;
#else
return toonShade * _Brightness;
#endif
}
ENDCG
}
}
Fallback "Legacy Shaders/Diffuse"
}