Oculus quest performance with instances

Hi

I tested adding different number of simple cube instances to scene. With 400 I am still getting 72 fps but with 1000 the fps is dropped in the order 50 fps. At the latter case the GPU is around 80% and CPU 50%. When I add around 4000 primitives the fps drops to 25 and I get stalled frames. The GPU and CPU drop to lower values. Any idea what could be happening and is this normal?

I tried to enable all tricks given here:
https://doc.babylonjs.com/how_to/optimizing_your_scene

But they did not have considerable effect to the outcome. I would seem logical that you could add more instances to the scene than around 500 especially if you freeze the world matrix and any other computations done per instance per frame. Is there something else I could try disable than what was listed in the “Optimize Your Scene” page?

Update:

I set all me meshes always active and called freezeActiveMeshes. With this setting I could get up to 1000 instances with 72 fps. With 2500 instances I again got fps of 40-50. I guess the system is CPU bound when you have that many instances in the scene?

Kind regards,
Tommi

Hi

I do a lot of stuff for Daydream so I am guessing it might be a similar thing. With Daydream Google specifies the following for optimized performance.

no more than 50 active meshes per eye
no more than 300 000 vertices per eye

I have found that merging meshes works best. If it doesn’t move, merge it. Use multi-material mesh and put pretty much your whole scene (except moving parts) into a single mesh.

I am running Lenovo Mirage Solo with Daydream (pretty close to same capabilities as your system) and I get 75 frames steady putting a ton of stuff in the view.

Lastly - check that you limit your materials. If you use a multi-material for all merges stuff you should be groovy.

1 Like

Hi

Thank you for good advice. I did some tests with merge meshes and when merging large meshes it tended to become quite slow with babylonjs. Are you using the MergeMeshes function or have you written your own implementation? Ideally it would be useful to be able to add and remove small meshes to the environment mesh without needing to re-merge everything each time. I implemented something like this for threejs but I am not a bit hesitant starting to write something like that for babylonjs is as it is tricky and time consuming.

Cheers,
Tommi

You should also try using the awesome SPS:

https://doc.babylonjs.com/how_to/solid_particles

by @jerome

1 Like

Hi

Thank you. Do you know if SPS is using mesh instances or merging them together internally?

Br,
Tommi

It merges everything internally. Actually it doesn’t use MergeMeshes() but it builds as fast as possible the internal geometry to get a single final mesh.

That sounds promising. Need to test it out.

Cheers,
Tommi