-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDepth.fxsub
52 lines (45 loc) · 1.29 KB
/
Depth.fxsub
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
#include "../../ray.conf"
#include "../../shader/common.fxsub"
#if RECIEVER_ALPHA_MAP_ENABLE
texture DiffuseMap: MATERIALTEXTURE;
sampler DiffuseMapSamp = sampler_state {
texture = <DiffuseMap>;
MinFilter = POINT; MagFilter = POINT; MipFilter = POINT;
ADDRESSU = WRAP; ADDRESSV = WRAP;
};
#endif
void DepthObjectVS(
in float4 Position : POSITION,
in float2 Texcoord : TEXCOORD0,
out float3 oTexcoord : TEXCOORD0,
out float4 oPosition : POSITION)
{
oTexcoord = float3(Texcoord.xy, oPosition.w);
oPosition = mul(Position, matWorldViewProject);
}
float4 DepthObjectPS(float3 coord : TEXCOORD0) : COLOR
{
#if RECIEVER_ALPHA_ENABLE
clip(!opadd - 0.001f);
float alpha = MaterialDiffuse.a;
#if RECIEVER_ALPHA_MAP_ENABLE
if (use_texture) alpha *= tex2D(DiffuseMapSamp, coord.xy).a;
#endif
clip(alpha - 0.01);
#endif
return coord.z;
}
#define OBJECT_TEC(name, mmdpass)\
technique name<string MMDPass = mmdpass;\
>{\
pass DrawObject {\
AlphaTestEnable = false; AlphaBlendEnable = false;\
VertexShader = compile vs_3_0 DepthObjectVS();\
PixelShader = compile ps_3_0 DepthObjectPS();\
}\
}
OBJECT_TEC(DepthTec, "object")
OBJECT_TEC(DepthTecBS, "object_ss")
technique EdgeTec<string MMDPass = "edge";>{}
technique ShadowTec<string MMDPass = "shadow";>{}
technique ZplotTec<string MMDPass = "zplot";>{}