Limit shadow map to the viewing range (#12158)

This commit is contained in:
x2048 2022-03-31 22:40:59 +02:00 committed by GitHub
parent 31578303a4
commit 3dd7d7867b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,6 +93,8 @@ void DirectionalLight::update_frustum(const Camera *cam, Client *client, bool fo
float zNear = cam->getCameraNode()->getNearValue(); float zNear = cam->getCameraNode()->getNearValue();
float zFar = getMaxFarValue(); float zFar = getMaxFarValue();
if (!client->getEnv().getClientMap().getControl().range_all)
zFar = MYMIN(zFar, client->getEnv().getClientMap().getControl().wanted_range * BS);
/////////////////////////////////// ///////////////////////////////////
// update splits near and fars // update splits near and fars