There are some performance issues on mid-end devices and IDK what I should do next with it. I already inspected the code and don’t understand how to improve the rendering time.
My scene contains ~60 unique geometries. Almost all meshes have instances(from 5 to 500).
Basically, I have two types of objects: static and dynamic.
The Static objects don’t change over the time. Like Mountains, ground, flowers etc.
The Dynamic objects change over the time. For example, the plank can be placed in output cell in the sawmill or be attached to NPC which walks around the village.
I’m already using instancing and progressive mode. But maybe I miss something…
Also I tried to replace instancing to thinInstance but I didn’t help much.
So maybe SPS can help me for static objects? Or 1M verts are too much for WebGL?
It’s hard to say, because your screenshot shows good performance, with low figures everywhere…
We would need to see the same stats but on a lower-end device, to know where most of the time is spent.
As far as static meshes are concerned, you could try merging meshes that share the same material (if there are any), but the number of drawing calls is already low, so I don’t think you’d gain much…
If the drop in performance you’re seeing concerns mobiles, the problem may lie with blending/transparency, if you’re using them: (some?) mobiles are notorious for not always behaving well when blending is involved.
All my geometries are opaque… I’ll try to find or buy low-end device…
What do you think about dynamic objects? Do instanced meshes work good when you need to change their positions every frame? Or it worth to convert it into thinInstances? I’m only change the position/rotation/scale and not materials/alpha.
If you can use thin instances, it will always be better (as long as you don’t have millions of thin instances that are not visible on the screen!), because we do basically 0 management for them, whereas for a regular mesh or an instanced mesh, we do quite a lot. Using thin instances will reduce the number of active meshes, which is a bit high in your report.
Could you please explain the difference between one mesh(for example Merged from other geometries) with 200-300k verts or 10-15 meshes(100-1000verts each) with instances? How does it impact CPU/GPU? (one material in both cases).
If you merge several meshes into one, there will only be one draw call to render it, whereas you’ll have as many draw calls as meshes if they’re not merged.
What’s more, on the JS side, each mesh undergoes a number of operations before being displayed (there’s a loop over all the meshes in the scene in Scene._evaluateActiveMeshes). So having fewer meshes will reduce the time spent in this method (which is one of the most time-consuming).
Unfortunately no, because I work with Poki. But maybe in the future I share some parts of the code. But honestly, BabylonJS has a good documentation and this community where you can find an answer in 95% cases and its great!