GaussianBlur.fx 757 B

123456789101112131415161718192021222324252627282930313233
  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. sampler TextureSampler : register(s0);
  5. #define SAMPLE_COUNT 15
  6. float2 SampleOffsets[SAMPLE_COUNT];
  7. float SampleWeights[SAMPLE_COUNT];
  8. float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
  9. {
  10. float4 c = 0;
  11. // Combine a number of weighted image filter taps.
  12. for (int i = 0; i < SAMPLE_COUNT; i++)
  13. {
  14. c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
  15. }
  16. return c;
  17. }
  18. technique GaussianBlur
  19. {
  20. pass Pass1
  21. {
  22. PixelShader = compile ps_2_0 PixelShaderF();
  23. }
  24. }