From 926cbd0d49890772f911e6a6bedb7835605ced89 Mon Sep 17 00:00:00 2001 From: pryazha Date: Thu, 6 Feb 2025 12:38:09 +0500 Subject: change --- advanced_lighting/4.normal_mapping/shaders/depth.fs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 advanced_lighting/4.normal_mapping/shaders/depth.fs (limited to 'advanced_lighting/4.normal_mapping/shaders/depth.fs') diff --git a/advanced_lighting/4.normal_mapping/shaders/depth.fs b/advanced_lighting/4.normal_mapping/shaders/depth.fs new file mode 100644 index 0000000..88fb9e6 --- /dev/null +++ b/advanced_lighting/4.normal_mapping/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; +} -- cgit v1.2.3