//texture screenTexture : Diffuse; sampler2D screenSampler;// = sampler_state //{ // Texture = ; //}; // With HDR this should be set to 1.0f float threshold = 1.f; struct vertexOutput { float4 oPosition : POSITION; float2 oTexCoord : TEXCOORD0; }; float4 suppressLDR( float4 colour ) { float4 result; threshold *= colour.a; if(colour.r > threshold || colour.g > threshold || colour.b > threshold) result = colour; else result = float4(0,0,0,1); return result; } vertexOutput downsampleVP( float4 position : POSITION, float2 texCoord : TEXCOORD0 ) { vertexOutput OUT = (vertexOutput)0; OUT.oPosition = position; OUT.oTexCoord = texCoord; return OUT; } float4 downsampleFP( vertexOutput IN ) : COLOR0 { float4 texColour = tex2D(screenSampler, IN.oTexCoord);//float4(tex2D(screenSampler, IN.oTexCoord).rgb, 1.0f); // texColour = texColour/texColour.a; float4 result = suppressLDR(texColour); return result; } technique downsample { pass p0 { VertexProgram = compile vp30 downsampleVP(); FragmentProgram = compile fp40 downsampleFP(); DepthTestEnable = false; DepthMask = false; BlendEnable = false; } }