Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 460 core
- in vec4 FragPos;
- uniform vec3 lightPos;
- uniform float far_plane;
- void main()
- {
- // get distance between fragment and light source
- float lightDistance = length(FragPos.xyz - lightPos);
- // map to [0;1] range by dividing by far_plane
- lightDistance = lightDistance / far_plane;
- gl_FragDepth = lightDistance;
- // write this as modified depth
- }
Advertisement
Add Comment
Please, Sign In to add comment