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

34 lines
934 B
GLSL
Raw Normal View History

2021-04-10 09:14:16 +00:00
#version 330 core
layout(location = 0) out vec4 fragColor;
2021-04-10 09:14:16 +00:00
in vec2 texcoord;
2021-04-10 09:14:16 +00:00
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);
2021-04-10 09:14:16 +00:00
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;
2021-04-10 09:14:16 +00:00
sum += texture(tex, texcoord) * 0.2270270270;
2021-04-10 09:14:16 +00:00
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;
2021-04-10 09:14:16 +00:00
fragColor = sum;
}