blur1.frag 1.1KB

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