struct fragment { float4 position : POSITION; //screen position float4 color0 : COLOR0; float4 color1 : COLOR1; //lighting float2 texcoord0 : TEXCOORD0; float4 depthTexCoord: TEXCOORD1; float3 normal : TEXCOORD2; }; struct pixel { float4 color : COLOR; }; pixel main(fragment IN, uniform sampler2D shadowMap: TEXUNIT1, uniform float doTexturing) { pixel OUT; float4 col = IN.color0; // the depth buffer float4 depth = tex2Dproj(shadowMap, IN.SMTexCoord); float test = IN.depthTexCoord.z / IN.depthTexCoord.w; float shadow; shadow = (test < depth.x) ? 1.0 : 0.0; OUT.color = localcolor * shadow * IN.color1; return OUT; }