From 5eead77178a25ba2ef769fded328a0fae6d53fe9 Mon Sep 17 00:00:00 2001 From: ToHold <38291374+ToHold@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:18:01 +0200 Subject: [PATCH] Update camera.far and near from CSM.lightFar and lightNear If I do not do any mistake, I think it was the initially purpose of lightFar and lightNear properties. But they aren't updated when the value changes. So to avoid hard update like for each lights do csm.light.shadow.camera.far = csm.lightFar it would be nice to already have it in csm.update. --- src/CSM.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CSM.ts b/src/CSM.ts index 59307b5..f47ee40 100644 --- a/src/CSM.ts +++ b/src/CSM.ts @@ -257,6 +257,8 @@ class CSM { const shadowCam = light.shadow.camera; const texelWidth = ( shadowCam.right - shadowCam.left ) / this.shadowMapSize; const texelHeight = ( shadowCam.top - shadowCam.bottom ) / this.shadowMapSize; + shadowCam.far = this.lightFar; + shadowCam.near = this.lightNear; light.shadow.camera.updateMatrixWorld( true ); _cameraToLightMatrix.multiplyMatrices( light.shadow.camera.matrixWorldInverse, camera.matrixWorld ); frustums[ i ].toSpace( _cameraToLightMatrix, _lightSpaceFrustum );