Starting normal maps.

This commit is contained in:
Zed A. Shaw 2026-09-29 13:06:46 -04:00
parent 7ca9302834
commit e13e94ecce
146 changed files with 16471 additions and 0 deletions

View file

@ -0,0 +1,22 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D shadowMap;
uniform float near_plane;
uniform float far_plane;
// required when using a perspective projection matrix
float LinearizeDepth(float depth)
{
float z = depth * 2.0 - 1.0; // Back to NDC
return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));
}
void main()
{
float depthValue = texture(shadowMap, TexCoords).r;
// FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective
FragColor = vec4(vec3(depthValue), 1.0); // orthographic
}