Moving High complexity Meshes - Aggressive Mode

Hi Babylon Community,

I have a question about performance modes. We have a scene with about 10 very complex models that are each set to enabled(false), isVisible = false and some submeshes. These are each instanced once or twice. We get only around 10 FPS on Intermediate Performance mode but 60 FPS on Aggressive mode.

Now we would like to be able to select an instance on click and move it.

We tried to “get out” of Aggressive performance mode when we click on the models, but it does not seem to be possible to switch off of this mode. We still are not able to move the instance after setting scene.performancePriority to BABYLON.ScenePerformancePriority.BackwardCompatible.

We also tried to reproduce which part of Aggressive mode makes the performance boost possible but have not been able to reproduce it. The documentation says the difference between Intermediate and Aggressive mode is:

  • scene.skipFrustumClipping = true
  • mesh.doNotSyncBoundingInfo = true
  • scene.renderingManager.maintainStateBetweenFrames = true

Even if we set performancePriority to Intermediate and add those specific options to our code, it does not give us the boost the Aggressive mode provides.

What else is different between the two modes? Is there any more information on this?

Or alternatively, is there a way to “turn off” Aggressive mode on click so we can move our instance?

Here is my Debug Frame Step Duration in Aggressive mode:


And here in Intermediate mode:

I did a performance test in dev tools with Intermediate mode and it showed me that we have lots of dropped frames but the frame loading it says only takes 16ms.

Hello and welcome!

I believe you may find some clues in the source code:

You may also try to use GPU Picking for mesh selection instead of “usual” mesh picking - Babylon.js docs

As always, the repro in PlayGround will help a lot to find the right answer to your issue.

1 Like

Maybe this?

Thank you both for your responses!
I did look into the code but I still cannot figure out why parts of my mesh cannot be moved even after I turn performancePriority back to 0.
in my onSelect function I call scene.performancePriority = 0 and scene.unfreezeActiveMeshes(); which seems to “unfreeze” all of my child meshes who do NOT have submeshes. The ones who have submeshes do not unfreeze and cannot be moved.
Any Ideas?

Ok we found it. Aggressive performancePriority has a massive problem when you’re merging submeshes with multi materials and then try to leave aggressive mode.
Changed our merging strategy now and it works :slight_smile: Thanks again for the answers!

3 Likes