Skip to content

Commit 8a60960

Browse files
Mugen87RuthySheffi
authored andcommitted
ShadowMaskModel: Fix usage with non shadow casting light. (mrdoob#31081)
* ShadowMaskModel: Fix usage with non shadow casting light. * Examples: Move Jolt demo to WebGPU. * E2E: Update screenshot.
1 parent 380b8e1 commit 8a60960

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

examples/physics_jolt_instancing.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
<script type="importmap">
1616
{
1717
"imports": {
18-
"three": "../build/three.module.js",
18+
"three": "../build/three.webgpu.js",
19+
"three/webgpu": "../build/three.webgpu.js",
20+
"three/tsl": "../build/three.tsl.js",
1921
"three/addons/": "./jsm/"
2022
}
2123
}
@@ -56,6 +58,7 @@
5658
dirLight.position.set( 5, 5, 5 );
5759
dirLight.castShadow = true;
5860
dirLight.shadow.camera.zoom = 2;
61+
dirLight.shadow.bias = - 0.001;
5962
scene.add( dirLight );
6063

6164
const shadowPlane = new THREE.Mesh(
@@ -124,7 +127,7 @@
124127

125128
//
126129

127-
renderer = new THREE.WebGLRenderer( { antialias: true } );
130+
renderer = new THREE.WebGPURenderer( { antialias: true } );
128131
renderer.setPixelRatio( window.devicePixelRatio );
129132
renderer.setSize( window.innerWidth, window.innerHeight );
130133
renderer.setAnimationLoop( animate );
15.7 KB
Loading

src/nodes/functions/ShadowMaskModel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ class ShadowMaskModel extends LightingModel {
3232
*/
3333
direct( { lightNode } ) {
3434

35-
this.shadowNode.mulAssign( lightNode.shadowNode );
35+
if ( lightNode.shadowNode !== null ) {
36+
37+
this.shadowNode.mulAssign( lightNode.shadowNode );
38+
39+
}
3640

3741
}
3842

0 commit comments

Comments
 (0)