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: Fix shadows on objects with receiveShadow=false #28874

Merged

Conversation

RenaudRohlinger
Copy link
Collaborator

Description
Currently the meshes will always receive shadows if their castShadow property is true regardless if receiveShadow is false. This PR fixes the issue by resetting the colorNode in AnalyticLightNode when the shadow map is not needed.

For example, here the box is defined with the following properties:

box.castShadow = true;
box.receiveShadow = false;

Before:
Screenshot 2024-07-15 at 17 27 39

After:
Screenshot 2024-07-15 at 17 27 19

This contribution is funded by Utsubo

@RenaudRohlinger RenaudRohlinger added this to the r167 milestone Jul 15, 2024
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
460.7 kB (111.1 kB) 460.7 kB (111.1 kB) +0 B

@RenaudRohlinger RenaudRohlinger merged commit 20d6ad1 into mrdoob:dev Jul 15, 2024
12 checks passed
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