make sure the near plane for spot shadows is not negative

This commit is contained in:
Mathias Agopian
2021-11-01 14:18:36 -07:00
committed by Mathias Agopian
parent 3073b03d56
commit af7f87e19b

View File

@@ -439,7 +439,8 @@ void ShadowMap::computeShadowCameraSpot(float3 const& position, float3 const& di
// find decent near/far
// TODO: we can do much better by rejecting objects that don't intersect our frustum
ShadowMap::updateSceneInfo(Mv, scene, sceneInfo);
float nearPlane = -sceneInfo.lsNearFar.x;
// FIXME: we need a configuration minimum near plane (for now hardcoded to 1cm)
float nearPlane = std::max(0.01f, -sceneInfo.lsNearFar.x);
float farPlane = std::min(radius, -sceneInfo.lsNearFar.y);
float outerConeAngleDegrees = outerConeAngle * f::RAD_TO_DEG;