Guest User

Untitled

a guest
Jun 14th, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #version 460 core
  2. in vec4 FragPos;
  3.  
  4. uniform vec3 lightPos;
  5.  
  6. uniform float far_plane;
  7. void main()
  8. {
  9. // get distance between fragment and light source
  10. float lightDistance = length(FragPos.xyz - lightPos);
  11. // map to [0;1] range by dividing by far_plane
  12. lightDistance = lightDistance / far_plane;
  13. gl_FragDepth = lightDistance;
  14.  
  15. // write this as modified depth
  16. }
Advertisement
Add Comment
Please, Sign In to add comment