From 8a4f6da17e395674be1fefa522ccba4122aa4d20 Mon Sep 17 00:00:00 2001 From: aardgoose Date: Wed, 25 Sep 2024 12:00:55 +0100 Subject: [PATCH 1/5] enable/disable shadow --- src/nodes/lighting/AnalyticLightNode.js | 2 ++ src/renderers/common/nodes/Nodes.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/nodes/lighting/AnalyticLightNode.js b/src/nodes/lighting/AnalyticLightNode.js index d920cdd3d13dc8..e5bdf911b8d3c5 100644 --- a/src/nodes/lighting/AnalyticLightNode.js +++ b/src/nodes/lighting/AnalyticLightNode.js @@ -253,6 +253,8 @@ class AnalyticLightNode extends LightingNode { const { object, renderer } = builder; + if ( renderer.shadowMap.enabled === false ) return; + let shadowColorNode = this.shadowColorNode; if ( shadowColorNode === null ) { diff --git a/src/renderers/common/nodes/Nodes.js b/src/renderers/common/nodes/Nodes.js index a4ab3d8c744087..b3404f68e6ded7 100644 --- a/src/renderers/common/nodes/Nodes.js +++ b/src/renderers/common/nodes/Nodes.js @@ -233,6 +233,8 @@ class Nodes extends DataMap { if ( environmentNode ) values.push( environmentNode.getCacheKey() ); if ( fogNode ) values.push( fogNode.getCacheKey() ); + values.push( this.renderer.shadowMap.enabled ); + cacheKeyData = { callId, cacheKey: hashArray( values ) From ee945e2e32f58ab8a8e7da3b25f2519f94cfd8d7 Mon Sep 17 00:00:00 2001 From: aardgoose Date: Wed, 25 Sep 2024 19:01:28 +0100 Subject: [PATCH 2/5] enable shadowmaps --- examples/webgpu_tsl_angular_slicing.html | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/webgpu_tsl_angular_slicing.html b/examples/webgpu_tsl_angular_slicing.html index 1d45991294a450..18d3b5dba0d517 100644 --- a/examples/webgpu_tsl_angular_slicing.html +++ b/examples/webgpu_tsl_angular_slicing.html @@ -194,6 +194,7 @@ renderer = new THREE.WebGPURenderer( { antialias: true } ); renderer.toneMapping = THREE.ACESFilmicToneMapping; renderer.toneMappingExposure = 1; + renderer.shadowMap.enabled = true; renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setAnimationLoop( animate ); From 594a027e3dc0598b4caf682eb35aa9592fc3874e Mon Sep 17 00:00:00 2001 From: aardgoose Date: Wed, 25 Sep 2024 19:15:36 +0100 Subject: [PATCH 3/5] enable more examples --- examples/webgpu_postprocessing_motion_blur.html | 1 + examples/webgpu_shadowmap_opacity.html | 1 + examples/webgpu_tsl_procedural_terrain.html | 1 + 3 files changed, 3 insertions(+) diff --git a/examples/webgpu_postprocessing_motion_blur.html b/examples/webgpu_postprocessing_motion_blur.html index 9614d68e7e20fc..80c7c5911fc404 100644 --- a/examples/webgpu_postprocessing_motion_blur.html +++ b/examples/webgpu_postprocessing_motion_blur.html @@ -155,6 +155,7 @@ renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setAnimationLoop( animate ); + renderer.shadowMap.enabled = true; document.body.appendChild( renderer.domElement ); stats = new Stats(); diff --git a/examples/webgpu_shadowmap_opacity.html b/examples/webgpu_shadowmap_opacity.html index 83126678d0f70b..16ee16caff64f5 100644 --- a/examples/webgpu_shadowmap_opacity.html +++ b/examples/webgpu_shadowmap_opacity.html @@ -48,6 +48,7 @@ renderer.setAnimationLoop( render ); renderer.toneMapping = THREE.AgXToneMapping; renderer.toneMappingExposure = 1.5; + renderer.shadowMap.enabled = true; container.appendChild( renderer.domElement ); scene = new THREE.Scene(); diff --git a/examples/webgpu_tsl_procedural_terrain.html b/examples/webgpu_tsl_procedural_terrain.html index b15d0de952dbc0..033bade17701ca 100644 --- a/examples/webgpu_tsl_procedural_terrain.html +++ b/examples/webgpu_tsl_procedural_terrain.html @@ -226,6 +226,7 @@ renderer = new THREE.WebGPURenderer( { antialias: true } ); renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.shadowMap.enabled = true; renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setAnimationLoop( animate ); From e03757c4f347a1b5272c0c7ce52dcafdfc1ddf61 Mon Sep 17 00:00:00 2001 From: aardgoose Date: Wed, 25 Sep 2024 19:24:05 +0100 Subject: [PATCH 4/5] and another one --- examples/webgpu_reflection.html | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/webgpu_reflection.html b/examples/webgpu_reflection.html index d1347892a938fd..9a729dd038a7fa 100644 --- a/examples/webgpu_reflection.html +++ b/examples/webgpu_reflection.html @@ -128,6 +128,7 @@ renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setAnimationLoop( animate ); + renderer.shadowMap.enabled = true; document.body.appendChild( renderer.domElement ); stats = new Stats(); From 969701fec07af3b4dad80f2f6dcd36276349b16b Mon Sep 17 00:00:00 2001 From: sunag Date: Wed, 25 Sep 2024 17:48:22 -0300 Subject: [PATCH 5/5] Update Nodes.js --- src/renderers/common/nodes/Nodes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderers/common/nodes/Nodes.js b/src/renderers/common/nodes/Nodes.js index b3404f68e6ded7..a33dd4fef7e176 100644 --- a/src/renderers/common/nodes/Nodes.js +++ b/src/renderers/common/nodes/Nodes.js @@ -233,7 +233,7 @@ class Nodes extends DataMap { if ( environmentNode ) values.push( environmentNode.getCacheKey() ); if ( fogNode ) values.push( fogNode.getCacheKey() ); - values.push( this.renderer.shadowMap.enabled ); + values.push( this.renderer.shadowMap.enabled ? 1 : 0 ); cacheKeyData = { callId,