فهرست منبع

ShadowMaskModel: Fix usage with non shadow casting light. (#31081)

* ShadowMaskModel: Fix usage with non shadow casting light.

* Examples: Move Jolt demo to WebGPU.

* E2E: Update screenshot.
Michael Herzog 8 ماه پیش
والد
کامیت
b9ba3b456f

+ 5 - 2
examples/physics_jolt_instancing.html

@@ -15,7 +15,9 @@
 		<script type="importmap">
 			{
 				"imports": {
-					"three": "../build/three.module.js",
+					"three": "../build/three.webgpu.js",
+					"three/webgpu": "../build/three.webgpu.js",
+					"three/tsl": "../build/three.tsl.js",
 					"three/addons/": "./jsm/"
 				}
 			}
@@ -56,6 +58,7 @@
 				dirLight.position.set( 5, 5, 5 );
 				dirLight.castShadow = true;
 				dirLight.shadow.camera.zoom = 2;
+				dirLight.shadow.bias = - 0.001;
 				scene.add( dirLight );
 
 				const shadowPlane = new THREE.Mesh(
@@ -124,7 +127,7 @@
 
 				//
 
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
+				renderer = new THREE.WebGPURenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setAnimationLoop( animate );

BIN
examples/screenshots/physics_jolt_instancing.jpg


+ 5 - 1
src/nodes/functions/ShadowMaskModel.js

@@ -32,7 +32,11 @@ class ShadowMaskModel extends LightingModel {
 	 */
 	direct( { lightNode } ) {
 
-		this.shadowNode.mulAssign( lightNode.shadowNode );
+		if ( lightNode.shadowNode !== null ) {
+
+			this.shadowNode.mulAssign( lightNode.shadowNode );
+
+		}
 
 	}
 

粤ICP备19079148号