No Description

debug.frag 807B

1234567891011121314151617181920212223242526272829
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. layout (binding = 1) uniform sampler2D samplerPosition;
  5. layout (binding = 2) uniform sampler2D samplerNormal;
  6. layout (binding = 3) uniform sampler2D samplerAlbedo;
  7. layout (binding = 5) uniform sampler2DArray samplerDepth;
  8. layout (location = 0) in vec3 inUV;
  9. layout (location = 0) out vec4 outFragColor;
  10. float LinearizeDepth(float depth)
  11. {
  12. float n = 0.1; // camera z near
  13. float f = 64.0; // camera z far
  14. float z = depth;
  15. return (2.0 * n) / (f + n - z * (f - n));
  16. }
  17. void main()
  18. {
  19. // Display depth from light's point-of-view
  20. // inUV.w = number of light source
  21. float depth = texture(samplerDepth, vec3(inUV)).r;
  22. outFragColor = vec4(vec3(1.0 - LinearizeDepth(depth)), 0.0);
  23. }