Skip to content

LightsNode: Honor map version in cache key. #31396

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
merged 1 commit into from
Jul 12, 2025
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 12, 2025

Related issue: #31330

Description

The custom cache key of LightsNode must honor the version of spot light maps otherwise a texture update is not correctly honored. webgpu_lights_projector only worked since the material observer forces a refresh for each new renderId. But if you add more than one objects that share a node builder state (and thus material observer) and are affected by the spot light, textured lighting breaks for all objects except the first one.

Note: The video texture also works now but there are still WebGPU warnings in the console:

External texture [ExternalTexture (unlabeled)] used in a submit is not active.
Destroyed texture [Texture "IOSurface(Gles2Read|RasterRead|DisplayRead|Scanout|WebgpuRead)"] used in a submit.

WebGL reports no warnings. Investigating this separately.

@Mugen87 Mugen87 added this to the r179 milestone Jul 12, 2025
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.27
78.93
338.27
78.93
+0 B
+0 B
WebGPU 558.51
154.58
558.54
154.59
+34 B
+9 B
WebGPU Nodes 557.43
154.36
557.46
154.37
+34 B
+9 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.62
113.66
469.62
113.66
+0 B
+0 B
WebGPU 634.14
171.61
634.18
171.62
+34 B
+7 B
WebGPU Nodes 589.28
160.95
589.31
160.95
+34 B
+7 B

@Mugen87 Mugen87 merged commit 2f1c6c0 into mrdoob:dev Jul 12, 2025
9 checks passed
@ycw
Copy link
Contributor

ycw commented Jul 16, 2025

It'd rebuild nodes for each video texture update, in turns huge frames drop

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jul 16, 2025

Indeed, the refresh isn't performant yet for video textures combined with SpotLight.map. We must track somehow the version to trigger a bindings update though.

@ycw
Copy link
Contributor

ycw commented Jul 16, 2025

That's what I tried to achieve at #31369 but in sloppy way...

sunag added a commit to sunag/three.js that referenced this pull request Jul 18, 2025
sunag added a commit that referenced this pull request Jul 18, 2025
* Revert "LightsNode: Honor map version in cache key. (#31396)"

This reverts commit 2f1c6c0.

* add lights check

* add stats
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.

2 participants