blurring (not Gaussian blur)

This commit is contained in:
devZoGok
2021-10-19 19:06:40 +03:00
parent d699201592
commit 5159afba51
10 changed files with 167 additions and 12 deletions
+22
View File
@@ -0,0 +1,22 @@
#version 330 core
in vec2 texCoords;
out vec4 FragColor;
uniform bool horizontal;
uniform sampler2D tex;
void main(){
int amount=5;
float weight[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054,0.016216);
vec2 texel=1/textureSize(tex,0);
vec3 c=texture(tex,texCoords).rgb*weight[0];
for(int i=1;i<amount;i++){
vec2 offset=vec2(horizontal?texel.x:0,horizontal?0:texel.y);
c+=texture(tex,texCoords+offset*i).rgb*weight[i];
c+=texture(tex,texCoords-offset*i).rgb*weight[i];
}
FragColor=vec4(c,1);
}