Skip to content

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jan 6, 2025

Related issue: #30269

Description

This PR introduces VideoFrameTexture as an alternative way to define video data. Instead of using a video element, instances of VideoFrame can now be assigned to a texture. Every time this is done, the texture gets updated so the new data can be used for rendering. Tested with WebGPURenderer and WebGLRenderer.

This should hopefully improve workflows with the WebCodecs API.

@maddanio Can you please verify if this change set works for you?

Copy link

github-actions bot commented Jan 6, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.51
79.09
339.51
79.09
+0 B
+0 B
WebGPU 490.86
136.32
490.86
136.32
+0 B
+0 B
WebGPU Nodes 490.33
136.21
490.33
136.21
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.35
112.14
465.35
112.14
+0 B
+0 B
WebGPU 560.16
151.73
560.16
151.73
+0 B
+0 B
WebGPU Nodes 516.26
141.52
516.26
141.52
+0 B
+0 B

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jan 6, 2025

@mrdoob Regarding the API: Do you prefer a separate class VideoTextureFrame or is VideoTexture.setFrame() already sufficient?

@maddanio
Copy link

maddanio commented Jan 6, 2025

No I like your solution actually. Will test later or tomorrow

@maddanio
Copy link

maddanio commented Jan 7, 2025

hmm, seems you didnt update the build in repo. how am I supposed to test this via npm?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jan 7, 2025

I've updated the builds so you can test with npm.

@mrdoob
Copy link
Owner

mrdoob commented Jan 7, 2025

@mrdoob Regarding the API: Do you prefer a separate class VideoTextureFrame or is VideoTexture.setFrame() already sufficient?

I think VideoFrameTexture is more clear and didactical (teaches the developer about VideoFrame).

@Mugen87 Mugen87 changed the title VideoTexture: Introduce setFrame(). Introduce VideoFrameTexture. Jan 7, 2025
@sunag sunag added this to the r173 milestone Jan 7, 2025
@maddanio
Copy link

maddanio commented Jan 8, 2025

works fine!

@Mugen87 Mugen87 merged commit 48df2ee into mrdoob:dev Jan 8, 2025
21 checks passed
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.

4 participants