Browse Source

blur调优

master
blobt 4 years ago
parent
commit
11b68aeac3
  1. 4
      res/shader/fullscreenquad_gaussian_horizontal.fs
  2. 4
      res/shader/fullscreenquad_gaussian_vertical.fs

4
res/shader/fullscreenquad_gaussian_horizontal.fs

@ -12,7 +12,9 @@ void main()
float texelOffset = 1/100.0;
float weight[5] = float[](0.22,0.19,0.12,0.08,0.01);
for(int i = 0; i < 5; i++){
color = texture2D(U_MainTexture, V_Texcoord)*weight[0];
for(int i = 1; i < 5; i++){
color += texture2D(U_MainTexture, vec2(V_Texcoord.x+texelOffset*i, V_Texcoord.y))*weight[i];
color += texture2D(U_MainTexture, vec2(V_Texcoord.x-texelOffset*i, V_Texcoord.y))*weight[i];
}

4
res/shader/fullscreenquad_gaussian_vertical.fs

@ -12,7 +12,9 @@ void main()
float texelOffset = 1/100.0;
float weight[5] = float[](0.22,0.19,0.12,0.08,0.01);
for(int i = 0; i < 5; i++){
color = texture2D(U_MainTexture, V_Texcoord)*weight[0];
for(int i = 1; i < 5; i++){
color += texture2D(U_MainTexture, vec2(V_Texcoord.x, V_Texcoord.y+texelOffset*i))*weight[i];
color += texture2D(U_MainTexture, vec2(V_Texcoord.x, V_Texcoord.y-texelOffset*i))*weight[i];
}

Loading…
Cancel
Save