Skip to content

Commit b33936f

Browse files
authored
Support reversed depth (#31496)
1 parent a4f44f6 commit b33936f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/lights/LightShadow.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,25 @@ class LightShadow {
206206
_projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
207207
this._frustum.setFromProjectionMatrix( _projScreenMatrix );
208208

209-
shadowMatrix.set(
210-
0.5, 0.0, 0.0, 0.5,
211-
0.0, 0.5, 0.0, 0.5,
212-
0.0, 0.0, 0.5, 0.5,
213-
0.0, 0.0, 0.0, 1.0
214-
);
209+
if ( shadowCamera.reversedDepth ) {
210+
211+
shadowMatrix.set(
212+
0.5, 0.0, 0.0, 0.5,
213+
0.0, 0.5, 0.0, 0.5,
214+
0.0, 0.0, 1.0, 0.0,
215+
0.0, 0.0, 0.0, 1.0
216+
);
217+
218+
} else {
219+
220+
shadowMatrix.set(
221+
0.5, 0.0, 0.0, 0.5,
222+
0.0, 0.5, 0.0, 0.5,
223+
0.0, 0.0, 0.5, 0.5,
224+
0.0, 0.0, 0.0, 1.0
225+
);
226+
227+
}
215228

216229
shadowMatrix.multiply( _projScreenMatrix );
217230

0 commit comments

Comments
 (0)