aeon-199x/shaders/module/horizontal_blur.frag

24 lines
415 B
GLSL
Raw Normal View History

2024-04-17 10:54:58 -04:00
vec2 neighborOffset = vec2(1 / viewWidth, 0);
float avg(float l, float c, float r) {
return (l + c + r) / 3;
}
vec3 hblur() {
vec3 center = texture2D(gcolor, texcoord).rgb;
2024-05-05 17:20:01 -04:00
vec3 sum = vec3(0);
int count = 0;
for(int x = -2; x < 2; x++) {
vec2 pos = texcoord - (neighborOffset * x);
if(pos.x >= 0 && pos.x < viewWidth) {
sum += texture2D(gcolor, pos).rgb;
count++;
}
}
return sum / count;
2024-04-17 10:54:58 -04:00
}