Skip to content

NodeMaterialObserver: Force refresh for video textures. #31397

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 12, 2025

Related issue: #31330 (comment)

Description

Using video textures in WebGPU seems more complicated than in WebGL since it is not possible to share an external texture. We have to recreate the bind group and the external texture for each render item. For material properties, we can enforce this in NodeMaterialObserver.

However, if video textures are used as spot light maps, there is no obvious way to enforce a refresh. Hence, I have removed the video texture from the webgpu_lights_projector demo. I think we can only properly support them on material level. And even then they are a bit problematic for performance in WebGPU since we can't share bindings in the same way like with normal textures.

I suggest to state in the documentation that video textures are not supported in SpotLight.map.

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.54
154.59
558.57
154.59
+29 B
+7 B
WebGPU Nodes 557.46
154.37
557.49
154.38
+29 B
+7 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.18
171.62
634.21
171.63
+29 B
+9 B
WebGPU Nodes 589.31
160.95
589.34
160.96
+29 B
+10 B

@sunag
Copy link
Collaborator

sunag commented Jul 13, 2025

I'd like to analyze this in more detail. Currently we can take a uniform to an isolated group using uniform().setGroup() then we could share that group between materials using sharedUniformGroup(). But I didn't do the tests using VideoTexture.

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