BloomExtract.fx 609 B

12345678910111213141516171819202122232425
  1. // Pixel shader extracts the brighter areas of an image.
  2. // This is the first step in applying a bloom postprocess.
  3. sampler TextureSampler : register(s0);
  4. float BloomThreshold;
  5. float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
  6. {
  7. // Look up the original image color.
  8. float4 c = tex2D(TextureSampler, texCoord);
  9. // Adjust it to keep only values brighter than the specified threshold.
  10. return saturate((c - BloomThreshold) / (1 - BloomThreshold));
  11. }
  12. technique BloomExtract
  13. {
  14. pass Pass1
  15. {
  16. PixelShader = compile ps_2_0 PixelShaderF();
  17. }
  18. }