renderDepth.frag 374 B

1234567891011121314151617181920212223
  1. #version 330 core
  2. layout (location = 0) out vec4 outColor;
  3. uniform sampler2D u_depthTexture;
  4. uniform float u_far;
  5. uniform float u_close;
  6. in vec2 v_fragCoord;
  7. void main()
  8. {
  9. vec2 uv = v_fragCoord;
  10. uv += vec2(1,1);
  11. uv /= 2.0;
  12. float c = texture(u_depthTexture, uv).r;
  13. //c = (2.0 * u_close) / (u_far + u_close - c * (u_far - u_close));
  14. outColor = vec4(c,c,c,1);
  15. }