|
@@ -182,7 +182,7 @@ export default class CSM {
|
|
_bbox.getCenter( _center );
|
|
_bbox.getCenter( _center );
|
|
_center.z = _bbox.max.z + this.lightMargin;
|
|
_center.z = _bbox.max.z + this.lightMargin;
|
|
|
|
|
|
- let squaredBBWidth = _lightSpaceFrustum.vertices.far[ 0 ].distanceTo( _lightSpaceFrustum.vertices.far[ 2 ] );
|
|
|
|
|
|
+ let squaredBBWidth = _lightSpaceFrustum.vertices.far[ 0 ].distanceTo( _lightSpaceFrustum.vertices.near[ 2 ] );
|
|
if ( this.fade ) {
|
|
if ( this.fade ) {
|
|
|
|
|
|
// expand the shadow extents by the fade margin if fade is enabled.
|
|
// expand the shadow extents by the fade margin if fade is enabled.
|
|
@@ -198,7 +198,6 @@ export default class CSM {
|
|
const texelSize = squaredBBWidth / this.shadowMapSize;
|
|
const texelSize = squaredBBWidth / this.shadowMapSize;
|
|
_center.x = Math.floor( _center.x / texelSize ) * texelSize;
|
|
_center.x = Math.floor( _center.x / texelSize ) * texelSize;
|
|
_center.y = Math.floor( _center.y / texelSize ) * texelSize;
|
|
_center.y = Math.floor( _center.y / texelSize ) * texelSize;
|
|
- _center.z = Math.floor( _center.z / texelSize ) * texelSize;
|
|
|
|
_center.applyMatrix4( light.shadow.camera.matrixWorld );
|
|
_center.applyMatrix4( light.shadow.camera.matrixWorld );
|
|
|
|
|
|
light.shadow.camera.left = - squaredBBWidth / 2;
|
|
light.shadow.camera.left = - squaredBBWidth / 2;
|