blur2.frag 1014B

123456789101112131415161718192021222324
  1. #version 120
  2. uniform sampler2D texture;
  3. uniform vec2 screenSize;
  4. varying vec2 uvCoord;
  5. // Stolen from https://github.com/Jam3/glsl-fast-gaussian-blur kinda
  6. void main()
  7. {
  8. float radius = 1;
  9. vec4 color = vec4(0.0);
  10. vec2 off1 = vec2(1.411764705882353) * vec2( 0, radius );
  11. vec2 off2 = vec2(3.2941176470588234) * vec2( 0, radius );
  12. vec2 off3 = vec2(5.176470588235294) * vec2( 0, radius );
  13. color += texture2D(texture, uvCoord) * 0.1964825501511404;
  14. color += texture2D(texture, uvCoord + (off1 / screenSize)) * 0.2969069646728344;
  15. color += texture2D(texture, uvCoord - (off1 / screenSize)) * 0.2969069646728344;
  16. color += texture2D(texture, uvCoord + (off2 / screenSize)) * 0.09447039785044732;
  17. color += texture2D(texture, uvCoord - (off2 / screenSize)) * 0.09447039785044732;
  18. color += texture2D(texture, uvCoord + (off3 / screenSize)) * 0.010381362401148057;
  19. color += texture2D(texture, uvCoord - (off3 / screenSize)) * 0.010381362401148057;
  20. gl_FragColor = color;
  21. }