ScenePerformancePriority experiments

Well, I wanted to try make the settings for ScenePerformancePriority that were Intermediate, or Aggressive work for more scenes. The idea is that if your scene is actively doing something you coded, that you could add another line to drop back to BackwardCompatible for one frame to get the change you made to a mesh in.

I started to make a PG, https://www.babylonjs-playground.com/#KFQ00T#2. It is not working. The mesh in the scene is also a button which toggles the subMaterials[1] between Red & Grey. Strangely, It will go to Red, but just disappears when supposed to go back to Grey, while in Aggressive.

The question is can renderingManager.maintainStateBetweenFrames be switched back to true once set to false?


As an aside, ArcRotateCamera is not working with autoClear anything other than true, unless you are drawing the entire scene. I made it work temporarily, but after the first click. Probably any camera that moves

Seems like that could choke off many scenes from getting any benefits (unless they did it without using this feature), including most PG’s. Isn’t this just one gl call? How much could that save?

Yes! There is a setter that should work :slight_smile:

Honestly almost nothing unless you are on a super high DPI screen

Ok have found the scene.renderingManager, so you could directly call scene.renderingManager.maintainStateBetweenFrames = false;.

I am doing that indirectly by setting
scene.performancePriority = BABYLON.ScenePerformancePriority.BackwardCompatible; in a executeOnceBeforeRender().

Then there is also an AfterRender which sets back to Aggressive, so that there should be one frame rendered in BackwardCaompatible. The issue above happens. It only happens Aggressive, so it either has to be the renderingManager or the skipFrustrumClipping.

Well the docs DO say, that any priority other than BackwardCompatible are not backward compatible themselves, so you could drop autoClear, to get better usage, “Legally”.

PS: Isn’t AR hosed if they try using this feature as well? They clear with with a clear color, but they still need to clear, right?

Yea totally!