poisson_interp.frag 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) 2020, Inria
  3. * GRAPHDECO research group, https://team.inria.fr/graphdeco
  4. * All rights reserved.
  5. *
  6. * This software is free for non-commercial, research and evaluation use
  7. * under the terms of the LICENSE.md file.
  8. *
  9. * For inquiries contact sibr@inria.fr and/or George.Drettakis@inria.fr
  10. */
  11. #version 420
  12. uniform float scale;
  13. layout(binding = 0) uniform sampler2D coarse;
  14. layout(binding = 1) uniform sampler2D constraint;
  15. layout(location= 0) out vec4 out_color;
  16. in vec4 texcoord;
  17. void main(void) {
  18. // sample color from lower multigrid level by scaling texture coordinates
  19. vec4 color = texture(coarse,vec2(gl_FragCoord.xy/scale)/textureSize(coarse,0).xy,0);
  20. // sample Dirichlet constraint without texture filtering because pixel without
  21. // Dirichlet constraint are black and texture filtering may break this check
  22. vec4 cons = texelFetch(constraint,ivec2(gl_FragCoord),0);
  23. // write color of lower level to output except holes pixels in the constraint
  24. if (any(greaterThan(cons.rgb,vec3(0.01))))
  25. out_color = cons;
  26. else
  27. out_color = color;
  28. }