-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathPrimoToon-shadows.hlsl
69 lines (49 loc) · 1.63 KB
/
PrimoToon-shadows.hlsl
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
struct appdata{
vector<float, 4> vertex : POSITION;
vector<float, 3> normal : NORMAL;
vector<float, 2> uv0 : TEXCOORD0;
vector<float, 2> uv1 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f{
vector<float, 4> pos : SV_POSITION;
vector<float, 4> uv : TEXCOORD0;
vector<float, 4> vertexOS : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert (appdata v){
v2f o = (v2f)0;
o.uv.xy = v.uv0;
o.uv.zw = v.uv1;
o.vertexOS = v.vertex;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
return o;
}
vector<float, 4> frag (v2f i) : SV_Target{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
// sample textures to objects
vector<fixed, 4> mainTex = _MainTex.Sample(sampler_MainTex, vector<half, 2>(i.uv.xy));
/* WEAPON */
if(_UseWeapon != 0.0){
vector<half, 2> weaponUVs = (_ProceduralUVs != 0.0) ? (i.vertexOS.zx + 0.25) * 1.5 : i.uv.zw;
vector<fixed, 3> dissolve = 0.0;
/* DISSOLVE */
calculateDissolve(dissolve, weaponUVs.xy, 1.0);
/*buf = dissolveTex < 0.99;
dissolveTex.x -= 0.001;
dissolveTex.x = dissolveTex.x < 0.0;
dissolveTex.x = (buf) ? dissolveTex.x : 0.0;*/
/* END OF DISSOLVE */
// apply dissolve
//globalOutlineColor.w = dissolve.x;
clip(dissolve.x - _ClipAlphaThreshold);
}
/* END OF WEAPON */
/* CUTOUT TRANSPARENCY */
if(_MainTexAlphaUse == 1.0) clip(mainTex.w - 0.03 - _MainTexAlphaCutoff);
/* END OF CUTOUT TRANSPARENCY */
return 0;
}