1 2 3 4 5 6 7 8 9 10 11 12
#version 330 core in vec3 v_world_pos; uniform vec3 light_pos; uniform float far_plane; out float frag_depth; void main() { frag_depth = length(v_world_pos - light_pos) / far_plane; }