Skip to content

Commit c43288e

Browse files
authored
ShadowNode: Fix updateMatrices sequence (#30064)
* fix `updateMatrices` sequence * Update webgpu_lights_spotlight.jpg
1 parent c99f1e9 commit c43288e

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

examples/jsm/csm/CSMShadowNode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class CSMShadowNode extends ShadowBaseNode {
7575
for ( let i = 0; i < this.cascades; i ++ ) {
7676

7777
const lwLight = new LwLight();
78+
lwLight.castShadow = true;
79+
7880
const lShadow = light.shadow.clone();
7981
lShadow.bias = lShadow.bias * ( i + 1 );
8082

-12 Bytes
Loading

src/nodes/accessors/Lights.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export function lightShadowMatrix( light ) {
2424

2525
return data.shadowMatrix || ( data.shadowMatrix = uniform( 'mat4' ).setGroup( renderGroup ).onRenderUpdate( () => {
2626

27-
light.shadow.updateMatrices( light );
27+
if ( light.castShadow !== true ) {
28+
29+
light.shadow.updateMatrices( light );
30+
31+
}
2832

2933
return light.shadow.matrix;
3034

src/nodes/lighting/ShadowNode.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,11 @@ class ShadowNode extends ShadowBaseNode {
452452

453453
renderShadow( frame ) {
454454

455-
const { shadow, shadowMap } = this;
455+
const { shadow, shadowMap, light } = this;
456456
const { renderer, scene } = frame;
457457

458+
shadow.updateMatrices( light );
459+
458460
shadowMap.setSize( shadow.mapSize.width, shadow.mapSize.height );
459461

460462
renderer.render( scene, shadow.camera );

0 commit comments

Comments
 (0)