stk-code_catmod/data/shaders/gaussian6h.frag
vlj e5a5c78045 Use a big triangle instead of 2 to cover full screen.
This allows to rasterize a single primitive instead of two, and avoid
trashing the cache between the 2 triangles drawing.
2014-06-03 19:56:59 +02:00

25 lines
704 B
GLSL

uniform sampler2D tex;
uniform vec2 pixel;
// Gaussian separated blur with radius 6.
out vec4 FragColor;
void main()
{
vec2 uv = gl_FragCoord.xy * pixel;
vec4 sum = vec4(0.0);
float X = uv.x;
float Y = uv.y;
sum += texture(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869;
sum += texture(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481;
sum += texture(tex, vec2(X, Y)) * 0.209473;
sum += texture(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481;
sum += texture(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869;
FragColor = sum;
}