Number of meshes significantly drop fps

Hey guys,

I’m trying to improve fps in my scene.

i simplified scene to have only few types of meshes. all of them are instances.

when i have 4000 meshes total i have ~105 fps

when i have 9000 meshes( but in camera view i see the same picture all of other meshes are outside of camera view) i have 23-30 fps

all other parameters almost the same

Looks like babylon have some calculations for meshes ( i checked different culling strategies but no performance improve)

Any thoughts? Thanks!

you can try multiple things:

  • Mark all meshes as always selected so there is no more culling
  • Try to freeze your scene

But mostly do a profiler and see which functions are the slower

Nice read for you: Optimizing Your Scene | Babylon.js Documentation

Hey @Deltakosh ,

already did everything(which suitable for me) from link.

what you mean freeze scene? i already froze everything i could( materials, worldmatrixes)

Thanks!

I meant this one: Optimizing Your Scene | Babylon.js Documentation

How is your profiler? Who are the main contenders?

24068 line from babylon.js file. it takes 54.38 ms

does not help:) We need to see what is inside the ignore list in your case

You should be able to see more details with map files (that are part of the package).

like that?

this is profile for case when 4000 meshes(high performance)

i noticed that there is sometimes no animate call and it’s shorter than in 9000 meshes case

You have a lot on the RTT. Do you have mirrors or shadows? This may be the opportunity to optimize what is render inside the RTT

evaluate active mesh should be far smaller if you are freezing the scene.

We will need a repro in the PG to help further

i disabled shadows for this test. what is RTT?

RenderTargetTextures

As @Deltakosh said, freezing and selecting all as active should skip the mesh selection loop, this is your main concern.

#38 from here:

It’s tested and it works.

Your draw calls are pretty low in both cases so this should really help.

Seems most CPU time taken by MorphTargetManager._syncActiveTargets, which updates the influence of each morph target. It seems there is a lot of meshes animated morph targets, or a mesh with a lot of animated morph targets.
To optimize for fps, consider reducing the count of morph target per mesh, removing static morph targets, and replacing morph targets with bones if possible.

Oh, wait, seems for mesh with multiple animated morph targets, _syncActiveTargets would be called multiple time for the same mesh, this could be something needed to be fixed.