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
|
#ifndef SHADOW_FRAG
#define SHADOW_FRAG
float2 _MainDistanceFade;
float _ForceOpaque;
float _MainShadowClipMod;
float2 _ClippingMaskPan;
float _ClippingMaskUV;
sampler3D _DitherMaskLOD;
float2 _MainTexPan;
float _MainTextureUV;
float _Inverse_Clipping;
half4 fragShadowCaster(
#if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
V2FShadow i, uint facing: SV_IsFrontFace
#endif
): SV_Target
{
poiMesh.uv[0] = i.uv;
poiMesh.uv[1] = i.uv1;
poiMesh.uv[2] = i.uv2;
poiMesh.uv[3] = i.uv3;
// Basically every texture relies on the maintex sampler to function and that's why this is here.
float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[float(0)], _MainTex) + _Time.x * float4(0,0,0,0));
//Possible Bug with clip
float clipValue = clamp(float(0.5) + float(0), - .001, 1.001);
poiMesh.vertexColor = saturate(i.vertexColor);
poiMesh.worldPos = i.worldPos;
poiMesh.localPos = i.localPos;
#ifdef POI_MIRROR
applyMirrorRenderFrag();
#endif
#if defined(UNITY_STANDARD_USE_SHADOW_UVS)
half4 alpha = mainTexture;
#if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
if (float(0))
{
if(IsInMirror())
{
alpha.a = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(i.uv, _MirrorTexture)).a;
}
}
#endif
alpha.a *= smoothstep(float4(0,0,0,0).x, float4(0,0,0,0).y, distance(i.modelPos, _WorldSpaceCameraPos));
half alphaMask = POI2D_PAN(_ClippingMask, poiMesh.uv[float(0)], float4(0,0,0,0));
if(float(0))
{
alphaMask = 1 - alphaMask;
}
alpha.a *= alphaMask;
alpha.a *= float4(0.01061847,0.01061847,0.01061847,1).a + .0001;
alpha.a += float(0);
alpha.a = saturate(alpha.a);
if(float(0) == 0)
{
alpha.a = 1;
}
if(float(0) == 1)
{
applyShadowDithering(alpha.a, calcScreenUVs(i.grabPos).xy);
}
#ifdef POI_DISSOLVE
float3 fakeEmission = 1;
calculateDissolve(alpha, fakeEmission);
#endif
if(float(0) == 1)
{
clip(alpha.a - 0.001);
}
/*
return poiMesh.vertexColor.g;
#ifdef POI_RANDOM
alpha.a *= i.angleAlpha;
#endif
if(float(0) >= 1)
{
applySpawnInShadow(uv[0], i.localPos);
#if defined(POI_FLIPBOOK)
alpha.a *= applyFlipbookAlphaToShadow(uv[float(0)]);
#endif
}
*/
if (float(0) == 1)
{
clip(alpha.a - clipValue);
}
if(float(0) > 1)
{
float dither = tex3D(_DitherMaskLOD, float3(i.pos.xy * .25, alpha.a * 0.9375)).a;
clip(dither - 0.01);
}
#endif
SHADOW_CASTER_FRAGMENT(i)
}
#endif
|