GaussianBlur.fx 827 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Pixel shader applies a one dimensional gaussian blur filter.
  2. // This is used twice by the bloom postprocess, first to
  3. // blur horizontally, and then again to blur vertically.
  4. #include "Macros.hlsl"
  5. DECLARE_TEXTURE(TextureSampler, 0);
  6. #define SAMPLE_COUNT 15
  7. BEGIN_CONSTANTS
  8. float2 SampleOffsets[SAMPLE_COUNT];
  9. float SampleWeights[SAMPLE_COUNT];
  10. END_CONSTANTS
  11. float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
  12. {
  13. float4 c = 0;
  14. // Combine a number of weighted image filter taps.
  15. for (int i = 0; i < SAMPLE_COUNT; i++)
  16. {
  17. c += SAMPLE_TEXTURE(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
  18. }
  19. return c;
  20. }
  21. technique GaussianBlur
  22. {
  23. pass Pass1
  24. {
  25. PixelShader = compile PS_SHADERMODEL PixelShaderF();
  26. }
  27. }