GaussianBlur.fsh 490 B

123456789101112131415161718
  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. uniform sampler2D TextureSampler_s0;
  5. uniform vec2 SampleOffsets[15];
  6. uniform float SampleWeights[15];
  7. void main()
  8. {
  9. vec4 c = vec4(0);
  10. for(int i=0; i < 15; i++)
  11. {
  12. c += texture2D(TextureSampler_s0, gl_TexCoord[0].xy + SampleOffsets[i]) * SampleWeights[i];
  13. }
  14. gl_FragColor = c;
  15. }