fix lispsm when camera and light direction are aligned

in that case we have to revert to the ortho projection
This commit is contained in:
Mathias Agopian
2022-09-30 14:58:58 -07:00
committed by Mathias Agopian
parent 44fdf83e4c
commit 3e3bd2722f

View File

@@ -511,7 +511,8 @@ mat4f ShadowMap::applyLISPSM(mat4f& Wp,
mat4f W;
// see nopt1 below for an explanation about this test
// sinLV is positive since it comes from a square-root
if (sinLV > 0 && 3.0f * (dzn / (zf - zn)) < 2.0f) {
constexpr float epsilon = 0.02f; // very roughly 1 degree
if (sinLV > epsilon && 3.0f * (dzn / (zf - zn)) < 2.0f) {
// nopt is the optimal near plane distance of Wp (i.e. distance from P).
// virtual near and far planes