gaussian3v.frag 560 B

1234567891011121314151617181920212223
  1. uniform sampler2D tex;
  2. uniform vec2 pixel;
  3. // Gaussian separated blur with radius 3.
  4. out vec4 FragColor;
  5. void main()
  6. {
  7. vec2 uv = gl_FragCoord.xy * pixel;
  8. vec4 sum = vec4(0.0);
  9. float X = uv.x;
  10. float Y = uv.y;
  11. sum += texture(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125;
  12. sum += texture(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125;
  13. sum += texture(tex, vec2(X, Y)) * 0.273438;
  14. sum += texture(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125;
  15. sum += texture(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125;
  16. FragColor = sum;
  17. }