sampler2D Tex0; sampler2D FadeTex; sampler2D DS; struct PS_INPUT{ float4 Color0 : COLOR0; float4 Color1 : COLOR1; float2 Tex : TEXCOORD0; float2 Fade : TEXCOORD1; float2 Pos : VPOS; float4 Depth : TEXCOORD2; }; struct PS_OUTPUT{ float4 Color : COLOR; }; float2 InvRes; PS_OUTPUT main(const PS_INPUT Input){ float Depth = tex2D(DS, (Input.Pos + 0.5f) * InvRes); float Fade = tex2D(FadeTex, Input.Fade); float4 Color = lerp(Input.Color0, Input.Color1, Fade); PS_OUTPUT Out; Out.Color = tex2D(Tex0, Input.Tex) * Color; #ifdef ADDITIVE Out.Color.rgb *= Out.Color.a; Out.Color.a = 0; #endif //float Diff = (Input.Depth.z / Input.Depth.w) - Depth; //Out.Color *= clamp(-Diff, 0, 1); /*if ((Input.Depth.z / Input.Depth.w) > Depth){ Out.Color = 0; }*/ float LocalDepth = Input.Depth.z / Input.Depth.w; //Out.Color = lerp(Out.Color, 0, clamp(LocalDepth - Depth, 0, 1)); //Out.Color *= clamp(LocalDepth - Depth, 0, 1); if (LocalDepth - Depth > 0){ Out.Color = 0; } return Out; }