Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: respect the renderer.shadowMap.enabled property #29492

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/webgpu_postprocessing_motion_blur.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/webgpu_reflection.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/webgpu_shadowmap_opacity.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions examples/webgpu_tsl_angular_slicing.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions examples/webgpu_tsl_procedural_terrain.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 2 additions & 0 deletions src/nodes/lighting/AnalyticLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 2 additions & 0 deletions src/renderers/common/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? 1 : 0 );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed it to integer to follow the pattern of the others hashes, but we can consider adding booleans to the hashArray in the future.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now , I changed renderer.shadowMap.enabled and renderer.shadowMap.type property, The scene not refresh scene shadow, I need changed light castShadow then scene can refresh shadow, I think it is not good, and it is a bug, I think the previous one was better。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use is webglRender


cacheKeyData = {
callId,
cacheKey: hashArray( values )
Expand Down