From 3dd7d7867b14058d3329f1ce2bd2e85713ff50b1 Mon Sep 17 00:00:00 2001 From: x2048 Date: Thu, 31 Mar 2022 22:40:59 +0200 Subject: Limit shadow map to the viewing range (#12158) --- src/client/shadows/dynamicshadows.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/shadows/dynamicshadows.cpp b/src/client/shadows/dynamicshadows.cpp index a45bf64fe..2995ec205 100644 --- a/src/client/shadows/dynamicshadows.cpp +++ b/src/client/shadows/dynamicshadows.cpp @@ -93,6 +93,8 @@ void DirectionalLight::update_frustum(const Camera *cam, Client *client, bool fo float zNear = cam->getCameraNode()->getNearValue(); 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 -- cgit v1.2.3