1
0
Fork 0
fgdata/Shaders/HDR/blur.frag

34 lines
904 B
GLSL
Raw Normal View History

2021-04-10 09:14:16 +00:00
#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;
}