\[ I = I_{a}m_{a} + \sum_{l} \text{shadow}_l(\vec{p}) * \left( I_{l}m_{d}(\mathbf{n}\cdot \mathbf{l}) + I_{l}m_{s}(\mathbf{r} \cdot \mathbf{v})^{s} \right) \\ \quad \text{with shadow}_l(\vec{p}) \;=\; \left\{\begin{array}{ll} 1 & \text{light $l$ is visible from } \vec{p},\\ 0 & \text{light $l$ is blocked from } \vec{p} \end{array} \right. \]
??

For each light:
glDepthFunc(GL_LEQUAL);glBlendFuncfovy and aspect ratio parameters that produce the viewing frustum shown above.near = 0.1, far = 6.mat4::look_at(vec3 eye, vec3 center, vec3 up)up vectorglDisable(GL_CULL_FACE);
shadowmap_gen.frag to output the Euclidean distance form the light to each fragment rendered.neutral.off if you press ‘C’ twice and cycle through with the ‘F’ key:phong_shadow.frag to compute the diffuse and specular light contributionstexture(shadow_map, light_ray).r