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

Improve performance. #22

Open
brandon-reinhart opened this issue May 2, 2024 · 1 comment
Open

Improve performance. #22

brandon-reinhart opened this issue May 2, 2024 · 1 comment
Assignees

Comments

@brandon-reinhart
Copy link
Collaborator

brandon-reinhart commented May 2, 2024

I'm going to make a tracking issue here.

Currently, bevy spine's perf doesn't scale or leverage the advantages we'd expect from a skeletal animation system. These are all solvable, but may take some tinkering. (I'd like to work on some or all of this, but I have a move coming up so it might not be until after the summer).

Major things to address:

  • Don't update the mesh on the CPU every frame.
  • Instance meshes.
  • Skin on the GPU.

These changes should be possible without significantly changing the bevy_spine API.

I don't know if the underlying rusty_spine transpile is sufficient, but I'd guess that it is? Any spine_c based gpu skinning shader for spine on another engine platform would be an existence proof that these problems are solvable.

Instead of using the rusty_spine CPU skinning, we'd want to have a gpu buffer that contains the mesh instance information and a per-entity buffer that contains that entity's specific animation state (bone transforms, etc). rusty_spine should already contain this information.

The skinning shader itself would probably function similar to bevy's existing 3d animation skinning shader which is just some matrix math. I'm also assuming that Spine has mathy idiosyncrasies we'd need to extract from their software skinning implementation and duplicate in the shader code.

@brandon-reinhart brandon-reinhart self-assigned this May 2, 2024
@jabuwu
Copy link
Owner

jabuwu commented May 3, 2024

I think it wouldn't be a bad idea to ask the Spine devs to weigh in, as I'm sure they've encountered these same problems. They're super responsive to GH issues and forum posts and I'm sure they'd be happy to give guidance on what's doable. 🙂

For my own expertise, I've only spent time with the C runtime, which uses CPU skinning. The other engine integrations seem more complicated, especially the Unity one, and might be doing things a bit smarter.

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

No branches or pull requests

2 participants