1
0
Fork 0
fgdata/Shaders/HDR/blur.frag
2021-07-23 07:46:05 +02:00

33 lines
904 B
GLSL

#version 330 core
out vec4 fragColor;
in vec2 texCoord;
uniform sampler2D tex;
uniform sampler2D prev_pass_tex;
uniform bool vertical = false;
void main()
{
vec2 offset = 1.0 / textureSize(tex, 0);
if (vertical) offset.x = 0.0;
else offset.y = 0.0;
vec4 sum = texture(prev_pass_tex, texCoord);
sum += texture(tex, texCoord - 4.0 * offset) * 0.0162162162;
sum += texture(tex, texCoord - 3.0 * offset) * 0.0540540541;
sum += texture(tex, texCoord - 2.0 * offset) * 0.1216216216;
sum += texture(tex, texCoord - 1.0 * offset) * 0.1945945946;
sum += texture(tex, texCoord) * 0.2270270270;
sum += texture(tex, texCoord + 1.0 * offset) * 0.1945945946;
sum += texture(tex, texCoord + 2.0 * offset) * 0.1216216216;
sum += texture(tex, texCoord + 3.0 * offset) * 0.0540540541;
sum += texture(tex, texCoord + 4.0 * offset) * 0.0162162162;
fragColor = sum;
}