diff options
Diffstat (limited to 'advanced_lighting/3.2.point_shadows/shaders/depth.fs')
-rw-r--r-- | advanced_lighting/3.2.point_shadows/shaders/depth.fs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/advanced_lighting/3.2.point_shadows/shaders/depth.fs b/advanced_lighting/3.2.point_shadows/shaders/depth.fs new file mode 100644 index 0000000..88fb9e6 --- /dev/null +++ b/advanced_lighting/3.2.point_shadows/shaders/depth.fs @@ -0,0 +1,14 @@ +#version 330 core + +in vec4 frag_pos; + +uniform vec3 light_pos; +uniform float far; + +void +main(void) +{ + float light_distance = length(frag_pos.xyz-light_pos); + light_distance = light_distance/far; + gl_FragDepth = light_distance; +} |