I’m having 1000 same characters on the scene that are playing the same animation (walking).
The FPS is obviously pretty bad.
Looking at the profiler, I’ve noticed that animation is recalculated for every single model, e.g. 1000 times per frame, so it takes 30ms out of 50ms for the rest of the code:
I wonder if it’s possible to calculate the bones transform once and then apply the result to every model at the scene, avoiding these repetitive calculations & 1000x animation evaluations in each frame?
In theory yes … but how likely is it that in the finished product you will need 1000 characters running completely in sync?
For a case you’re talking about, something like this would be a lot more performant:
Well, maybe not 1000, but having 200-300 units plus rest of the game logic may be a PITA. Especially on mobile devices.
Anyway saving 60% of the frame time would be super cool
There won’t be easy way to do this, as it’s not directly supported. But you could have just a single mesh on the screen, so that the engine would update its bones. Then you would grab those bones, grab verticies of that mesh and skin it on CPU every frame (basically multiply vertices by bones and stuff, not hard). Create another mesh from these skinned vertices. And then use instancing to simply place it 100s of times where needed. This would be super cheap on CPU.