BloomUpscale.frag.glsl 862 B

12345678910111213141516171819202122232425
  1. // Copyright (C) 2009-2017, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include "shaders/Common.glsl"
  6. layout(ANKI_TEX_BINDING(0, 0)) uniform mediump sampler2D u_tex;
  7. layout(location = 0) in vec2 in_texCoord;
  8. layout(location = 0) out vec3 out_color;
  9. void main()
  10. {
  11. const vec2 TEXEL_SIZE = 1.0 / vec2(WIDTH, HEIGHT);
  12. const float MIPMAP = 0.0;
  13. out_color = textureLod(u_tex, in_texCoord, MIPMAP).rgb;
  14. out_color += textureLod(u_tex, in_texCoord + TEXEL_SIZE, MIPMAP).rgb;
  15. out_color += textureLod(u_tex, in_texCoord - TEXEL_SIZE, MIPMAP).rgb;
  16. out_color += textureLod(u_tex, in_texCoord + vec2(TEXEL_SIZE.x, -TEXEL_SIZE.y), MIPMAP).rgb;
  17. out_color += textureLod(u_tex, in_texCoord + vec2(-TEXEL_SIZE.x, TEXEL_SIZE.y), MIPMAP).rgb;
  18. out_color /= 5.0;
  19. }