sampler2D Tex0; sampler2D DS; struct PS_INPUT{ float4 Color : COLOR0; float2 Tex : TEXCOORD0; float2 Pos : VPOS; float4 Depth : TEXCOORD1; }; struct PS_OUTPUT{ float4 Color : COLOR; }; float2 InvRes; PS_OUTPUT main(const PS_INPUT Input){ float Depth = tex2D(DS, (Input.Pos + 0.5f) * InvRes); PS_OUTPUT Out; Out.Color = tex2D(Tex0, Input.Tex) * Input.Color; Out.Color.rgb *= Out.Color.a; Out.Color.a = 0; if ((Input.Depth.z / Input.Depth.w) > Depth){ Out.Color = 0; } return Out; }