Skip to content

Conversation

@RenaudRohlinger
Copy link
Collaborator

Description
This PR allows to manually control the update of a shadow through the already available shadow.autoUpdate and shadow.needsUpdate properties.

Usage:

const dirLight = new THREE.DirectionalLight( 0xffffff, 10 );
dirLight.castShadow = true;
dirLight.shadow.autoUpdate = false;
dirLight.shadow.needsUpdate = true;

To demonstrate the feature, I updated the webgpu_shadowmap_opacity example:

Before:
Screenshot 2024-08-10 at 23 32 39

After:
Screenshot 2024-08-10 at 23 31 33

To ensure this feature works correctly, I had to account for the versioning of depthTexture. Without this, when the Renderer initialize the FBO in the first render loop, it updates the attached textures, leading to the incorrect shadowMap being bound to the meshes in subsequent renders.

This contribution is funded by Utsubo

@github-actions
Copy link

github-actions bot commented Aug 10, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
685.1 kB (169.6 kB) 685.1 kB (169.6 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
462 kB (111.4 kB) 462 kB (111.4 kB) +0 B

@RenaudRohlinger RenaudRohlinger added this to the r168 milestone Aug 10, 2024
@sunag
Copy link
Collaborator

sunag commented Aug 10, 2024

We could consider it to be the default if it is in a static group.

@sunag sunag merged commit 350d1c5 into mrdoob:dev Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants