Bones are dropping performance to the ground

Hey guys, i’m creating a game where multiple creatures(about 50 on the scene) are fighting each other(it means meshes are clones, not instances)

For performance tests i created demo project where i can play with meshes. For example when i add new mesh to the game i can test it for performance.
i create 225(15*15) meshes of that type and check fps of the scene.
I noticed bunch of strange behaviours which i can’t explain myself:

  1. Bones of imported mesh(i use glb format) gives significant drop of fps
    225 meshes without bones have 144fps
    225 of the same meshes with 40 bones (mesh without any animations) in it gives 20-40fps (depending on enabled shadows, glow etc)
  2. WebGL2 have higher fps than WebGPU

I’ve created playground where you can check those stranges

btw my fps on playground where ALL 225 is in camera view with WebGL2 is 27 fps


with WebGPU its 20

My question is why bones dropping fps at all if they are not visible?
Does it mean that it’s better to use WebGL2 and not WebGPU?
Is there any way to do fps higher for meshes with bones? Maybe some correct glb export or etc?
Thanks

1 Like

ok webgpu is better when you can do snapshot rendering: WebGPU Optimizations | Babylon.js Documentation (babylonjs.com)

Regarding bones, they are always computed (even if the mesh is not on the screen as they could potentially animate the mesh INTO the frustrum)

To optimize here, I would highly recommend using instances if you can else you will overload the system with bones computation

i can’t use instances because each mesh can have different active animation at a time

which means you have to compute the bones so no escape :frowning:

Would less bones help? Like LOD the armature?

1 Like

Would reducing the max bone influences per vertex increase the speed? I thought there was a setting somewhere that defaults to 4, but can’t remember exactly

1 Like

I already minimized number of bones, initially there was 120

https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
look like its here under preparing mesh block
but there is no info how to lower this value

I have 53 fps with them dancing, maybe you could lower the framerate of the animation?

meshes in tests in initial post don’t have any animations at all. I used this dancing girl mesh for playground example

Optimization tips maybe Babylon.js docs

already did all of them (at least tried, some of them is not suitable for me)

Maybe there is some way to stagger these computes DK spoke of,…

When there are lots of skeletons, you can try using baked vertex animations. There are some limitations, but some people have been able to make convincing use of them. Look for “baked vertex animation” or VAT in the forum. See also:

https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations

1 Like

I saw this but my game engine should have posibility to blend animations, because my creature animations can be “disrupted” by another creature animation (so new animation will be started to play from current position of mesh)