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

RenderObject: Fix geometry key for morph targets. #30302

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jan 10, 2025

Fixed #30192

Description

RenderObject.getGeometryCacheKey() must honor morph target attributes. However, a simple structural comparison like with normal buffer attributes isn't sufficient. Since the vertex data are maintained in a texture via MorphNode, render objects can only share a common node builder state if morph target data are equal. That is verified with a new id attribute on BufferAttribute level.

Copy link

github-actions bot commented Jan 10, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.52
79.1
339.52
79.1
+0 B
+0 B
WebGPU 490.99
136.33
491.07
136.35
+84 B
+14 B
WebGPU Nodes 490.45
136.22
490.54
136.24
+84 B
+15 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.36
112.15
465.41
112.15
+55 B
+8 B
WebGPU 560.28
151.74
560.42
151.75
+139 B
+13 B
WebGPU Nodes 516.38
141.53
516.52
141.57
+139 B
+44 B

@sunag sunag added this to the r173 milestone Jan 10, 2025
@sunag
Copy link
Collaborator

sunag commented Jan 10, 2025

Thanks @Mugen87 . I was working on this the last few days too. Your solution is great, maybe in the future we can update the texture uniform dynamically from getEntry() if the position, normal etc match, to take advantage of the cache.

@sunag sunag merged commit dd47363 into mrdoob:dev Jan 10, 2025
12 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.

WebGPURenderer: Mesh shapekeys deforming different geometry mesh
2 participants