|
|
@@ -145,6 +145,9 @@ class CSMFrustum {
|
|
|
|
|
|
target.length = breaks.length;
|
|
|
|
|
|
+ const near = this.vertices.near[ 0 ].z;
|
|
|
+ const far = this.vertices.far[ 0 ].z;
|
|
|
+
|
|
|
for ( let i = 0; i < breaks.length; i ++ ) {
|
|
|
|
|
|
const cascade = target[ i ];
|
|
|
@@ -159,9 +162,11 @@ class CSMFrustum {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
+ const alpha = ( breaks[ i - 1 ] * far - near ) / ( far - near );
|
|
|
+
|
|
|
for ( let j = 0; j < 4; j ++ ) {
|
|
|
|
|
|
- cascade.vertices.near[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i - 1 ] );
|
|
|
+ cascade.vertices.near[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], alpha );
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -177,9 +182,11 @@ class CSMFrustum {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
+ const alpha = ( breaks[ i ] * far - near ) / ( far - near );
|
|
|
+
|
|
|
for ( let j = 0; j < 4; j ++ ) {
|
|
|
|
|
|
- cascade.vertices.far[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i ] );
|
|
|
+ cascade.vertices.far[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], alpha );
|
|
|
|
|
|
}
|
|
|
|