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

InstancedMesh: Add support for morph targets. #27669

Merged
merged 5 commits into from
Feb 5, 2024

Conversation

wizgrav
Copy link
Contributor

@wizgrav wizgrav commented Feb 3, 2024

@Mugen87 I took a stub at adding full morph target support as I told you on the other PR and the results were surprisingly good. I don't notice any performance difference with the horse model which has 15 targets so it seems quite performant.

Now everything is loaded on a texture including the base influence so it will support every case and the API is identical to the attribute approach. I left the example as is and will make some more to test other cases but wont push in this PR

demo here (you may need to refresh cache to be sure, output is identical to the previous one)

Copy link

github-actions bot commented Feb 3, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
674.2 kB (167.5 kB) 675.9 kB (167.9 kB) +1.7 kB

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
455.1 kB (110.5 kB) 456.4 kB (110.7 kB) +1.36 kB

Copy link
Collaborator

@Mugen87 Mugen87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution looks awesome now!

@Mugen87 Mugen87 changed the title Instanced morph targets - full support InstancedMesh: Add support for morph targets. Feb 3, 2024
@Mugen87 Mugen87 added this to the r162 milestone Feb 3, 2024
@wizgrav
Copy link
Contributor Author

wizgrav commented Feb 3, 2024

@Mugen87 I wrote an example using the face and it's slower than the horse but that was not unexpected. I havent pushed it in the PR or even added it in the examples list but you can check it out directly here

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 5, 2024

Regarding the code complexity in WebGLRenderer: Yes, this PR adds additional complexity to the renderer but also adds a useful feature. When WebGL 1 support is removed next month, the renderer can be simplified at certain places. E.g. the entire WebGL 1 code path for morph targets can be deleted. That should keep the morph target related code manageable even with this PR in place.

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.

3 participants