|
|

楼主 |
发表于 2008-5-24 20:13:00
|
显示全部楼层
Re:shadowmap怎么才能透射alpha透明贴图?
我的深度是用shader渲染的,如果要算alphatest怎么搞?
void BuildShadowMapVS(float3 posL : POSITION0,
out float4 posH : POSITION0,
out float2 depth : TEXCOORD0)
{
// Render from light's perspective.
posH = mul(float4(posL, 1.0f), gLightWVP);
// Propagate z- and w-coordinates.
depth = posH.zw;
}
float4 BuildShadowMapPS(float2 depth : TEXCOORD0) : COLOR
{
// Each pixel in the shadow map stores the pixel depth from the
// light source in normalized device coordinates.
return depth.x / depth.y; // z / w
}
technique BuildShadowMapTech
{
pass P0
{
vertexShader = compile vs_2_0 BuildShadowMapVS();
pixelShader = compile ps_2_0 BuildShadowMapPS();
}
}
|
|