Skip to content

ShadowNode: Inherit camera.layers only if shadow.camera.layers is not set #30877

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

Merged

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Apr 6, 2025

Fixed: #30156 #30856

Description
Only inherit the camera layers if shadow.camera.layers is not set. This allows selective real-time/static shadows and resolves #30156 and #30856. /cc @sunag

This contribution is funded by Renaud Rohlinger @ Utsubo

Copy link

github-actions bot commented Apr 6, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.49
78.38
336.49
78.38
+0 B
+0 B
WebGPU 542.05
150.13
542.13
150.15
+87 B
+19 B
WebGPU Nodes 541.51
150.03
541.6
150.05
+87 B
+19 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.42
112.22
465.42
112.22
+0 B
+0 B
WebGPU 614.89
166.17
614.98
166.2
+87 B
+31 B
WebGPU Nodes 569.88
155.58
569.96
155.62
+87 B
+31 B

@RenaudRohlinger
Copy link
Collaborator Author

Should be a safe and useful addition. Since it's approved, I’ll go ahead and merge it.

@RenaudRohlinger RenaudRohlinger merged commit f35e494 into mrdoob:dev Apr 17, 2025
12 checks passed
@Mugen87 Mugen87 added this to the r176 milestone Apr 17, 2025
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
… set (mrdoob#30877)

* ShadowNode: Inherit camera.layers only if shadow.layers is not set

* Fix layers check

* invert condition

* restore after render

* move array creation to module scope
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
… set (mrdoob#30877)

* ShadowNode: Inherit camera.layers only if shadow.layers is not set

* Fix layers check

* invert condition

* restore after render

* move array creation to module scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Honor camera layers on light.shadow.camera for selective shadow
3 participants