More Meshes cause less FPS or the opposite?

More Meshes cause less FPS or the opposite?

When I started to render OpenStreetMap in 3D, each building and tree was an extra Mesh. Great for selecting. But to show all buildings of a city to the horizon was impossible. To get more FPS I merged the Meshes to small tiles of about 400x400 Meters. Then I added shadows, reflecting water etc. and the FPS are down to 2-4 again. The only way to get back to 10 was to define the horizons less far away which looks odd.

Desperate, I gambled with the tile size. Bigger tiles: less Meshes better FPS? NO! Thinned tiles with more Meshes caused more FPS! Now I am worried. Why? About 100x100 seems to be the optimum. Can anyone explain this?
(Ok, there are things like self casting shadow that makes the tiles CPU heavy.)

There are so many factors that influence your performance. The number of meshes is one of them. It also depends on the amount of materials, the complexity of those meshes, number of textures (and maybe their size as well). The meshes settings can also influence the scene. Are you picking constantly? did you set un-pickable meshes isPickable = false?

It is very much scene dependent. Finding the right balance is a holy grail that only you can find. You can ready about certain ways to optimize your scene here - Optimizing Your Scene | Babylon.js Documentation

I do use isPickable. But setting it to false does not “feel” better. May be 11 instead of 10 FPS.
The same with newMaterial.freeze();
This is certainly a complex topic and hard to test in the real application (
I will try to create a PlayGround with a similar complexity to applay all optimizations.

applying all optimizations will probably not work as you expect it to :slight_smile:

It will be great to see a reproduction of the scene to be able to give better optimization tips.