You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
517 B

4 years ago
4 years ago
4 years ago
  1. varying vec2 V_Texcoord;
  2. uniform sampler2D U_MainTexture;
  3. void main()
  4. {
  5. //1 2 1
  6. //2 4 2
  7. //1 2 1
  8. vec4 color = vec4(0.0);
  9. float texelOffset = 1/100.0;
  10. float weight[5] = float[](0.22,0.19,0.12,0.08,0.01);
  11. color = texture2D(U_MainTexture, V_Texcoord)*weight[0];
  12. for(int i = 1; i < 5; i++){
  13. color += texture2D(U_MainTexture, vec2(V_Texcoord.x, V_Texcoord.y+texelOffset*i))*weight[i];
  14. color += texture2D(U_MainTexture, vec2(V_Texcoord.x, V_Texcoord.y-texelOffset*i))*weight[i];
  15. }
  16. gl_FragColor = color;
  17. }