float4x4 matWorld;
float4x4 matWorldViewProj;
float4 vecViewPos;
float4 vecColor;
float vecSkill1;
texture entSkin1;
texture rttDepth_bmap;
sampler SKIN = sampler_state { texture = (entSkin1);};
sampler DEPTH = sampler_state { texture = (rttDepth_bmap);};
float4 VS ( in float4 P : POSITION, in float2 T : TEXCOORD0, out float2 tex : TEXCOORD0, out float3 depth : TEXCOORD1, out float4 pos : TEXCOORD2) : POSITION {
tex = T;
pos = mul(P,matWorld);
depth = mul(P,matWorldViewProj).xyw;
return mul(P,matWorldViewProj);
}
float4 PS ( in float2 tex : TEXCOORD0, in float3 depth : TEXCOORD1, in float4 pos : TEXCOORD2) : COLOR {
float4 color = tex2D(SKIN,tex) * vecColor;
float D = tex2D(DEPTH,0.5 * depth.xy / depth.z + 0.5);
color.a *= saturate((D - distance(pos,vecViewPos)) / vecSkill1.x);
return color;
}
technique t{
pass p{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PS();
}
}