I am having a performance issue with animations in a multiplayer game. When a considerable amount of people join the game (10-20 players), the performance drops down to levels that are incomprehensible.
The animations are evaluated even for characters that are off-screen (we have a ticket to change that), but the bones are not updated and uploaded to GPU so you save some performance here. Also, because you provide AABB, we can skip aabb calculation based on the skeleton, which is not super cheap either
We already have custom AABB on the models and it seems it is not related to GPU performance. I was wondering if there is any other way to optimize animations.
I was thinking of some sort of culling. If there is any way to detect if an object is being rendered, to stop the animator or start it.
Here are some screenshots of the Performance Recordings I have done.
I think perhaps the best way would be for you to do something like this:
update your camera (perhaps in update)
update your character positions (perhaps in update)
in postUpdate perhaps test if characters are visible, and disable them if not. That should work.
You can get a Frustum by cameraEntity.camera.frustum, and that has containsSphere code to test against a sphere based on the aabb.
And I think in addition to what Martin shared, reducing the amount of bones / complexity of the skeleton may help.
Also we have a system in our Solar Tools SDK where we patch the PlayCanvas engine to reduce the frequency of the animation update based on the camera distance. This works as a sort of animation LOD: