#version 330 in vec2 fragTexCoord; in vec4 fragColor; uniform sampler2D texture0; uniform vec4 diffuse; uniform vec2 resolution; uniform vec2 direction; out vec4 outColor; void main() { vec2 texel = direction / resolution; const float weight[5] = float[]( 0.22027, 0.1945946, 0.1216216, 0.054054, 0.016216 ); vec4 color = texture(texture0, fragTexCoord) * weight[0]; for (int i = 1; i < 5; i++) { vec2 offset = texel * float(i); color += texture(texture0, fragTexCoord + offset) * weight[i]; color += texture(texture0, fragTexCoord - offset) * weight[i]; } outColor = color * diffuse * fragColor; }