Implement correctly shadows on geometry, with arbitrary near plane cap

This commit is contained in:
2021-08-31 10:46:44 +01:00
parent cd0a82e526
commit 740abd1609
2 changed files with 22 additions and 4 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ vec4 projNear (vec4 pos)
// note we project to a specific height
// this is quite brittle, not ideal
vec3 dir = pos.xyz - lightPos ;
float a = (150 - pos.z) / dir.z ;
float a = (140 - pos.z) / dir.z ;
vec2 xy = (pos.xyz + a * dir).xy ;
return vec4 ( xy, 150 , 1) ;
return vec4 ( xy, 140 , 1) ;
}
void main()
{