ScenePerformancePriority.Aggressive bugs

I noticed a critical bug in my own project (@bablyonjs/core 6.24.0) with ScenePerformancePriority.Aggressive where the entire scene fails to render (without any provided errors) after dispose() is called on any mesh.

Upon creating a playground to isolate the issue, I also found that this setting causes a bug in the scene background rendering in the current version of BabylonJS (6.27.1).

Remove the comment mark on line 24 to see the bugs: https://www.babylonjs-playground.com/#XCPP9Y#20052

Test environments:
Windows 10 Pro N 22H2 (x86)
- Brave 1.59.117/120 (Chromium)
MacOS 13.2.1 (Apple M2)
- Brave 1.59.117/120 (Chromium)
- Safari 16.3 (WebKit)
iOS 15.5
- Brave 1.58 (WebKit)

Thanks a lot for the report, I am currently checking the performance mode bug.

Could you provide a repro regarding the background ?

Both bugs are reproducible in my environments using the provided playground.

The background is white instead of the normal blue pastel upon switching the performance mode, and you can simply rotate the camera before the 5-second freeze to accentuate the problem.

About the background, this is expected as with agressive mode, there is no more automated clear between frames to improve perf so you need to provide your own skybox or reenable the auto clear in case you do not have one. This is described in the performance mode doc. Optimizing Your Scene | Babylon.js Documentation
image

Disposing during an agressive mode is not expected as well as the scene is considered “frozen” regarding the list of meshes to render. This is also available in the doc:

I still temptatively automated here the dispose case as it was not requiring a huge change: Performance mode: Restore dispached flags in aggressive mode by sebavan · Pull Request #14489 · BabylonJS/Babylon.js · GitHub

But overall in aggressive mode everything is mostly frozen and when you create/update the scene graphe you should first stop this mode, then do the changes and put it back in.

2 Likes