struct VS_ShadowAlphaIN
{
float3 Position : POSITION;
float2 Texcoord : TEXCOORD0;
};
struct VS_ShadowAlphaOut
{
float4 Position : POSITION;
float2 Texcoord : TEXCOORD0;
float Depth : TEXCOORD1;
};
VS_ShadowAlphaOut VS_RenderShadowMapAlpha(VS_ShadowAlphaIN In)
{
VS_ShadowAlphaOut Out = (VS_ShadowAlphaOut)0;
float4 posWorld = mul(float4(In.Position,1), world);
Out.Position = mul(posWorld, viewprojection);
Out.Depth = Out.Position.z;
Out.Texcoord = In.Texcoord;
return Out;
}
float4 PS_RenderShadowMapAlpha(VS_ShadowAlphaOut In): COLOR
{
// *** worked
//float s = (tex2D(alphaDiffuseSampler, In.Texcoord).a > 0.6)? In.Depth : -1;
//clip(s);
//return s;
// *** not worked
return float4(In.Depth,In.Depth,In.Depth,tex2D(alphaDiffuseSampler, In.Texcoord).a);
}
technique RenderShadowMapAlpha
{
pass p0
{
CullMode = None;
AlphaTestEnable = true;
AlphaFunc = LessEqual;
AlphaRef = 150;
VertexShader = compile vs_2_0 VS_RenderShadowMapAlpha();
PixelShader = compile ps_2_0 PS_RenderShadowMapAlpha();
}
}
Where is my mistake?