Disable mesh selection + frustum clipping?

Hi, I see that a lot of time is spend on evaluateActiveMeshes, so my main question is if its possible to disable it at all?

My scene itself has only one orthographic camera and a 2.5d top down view, since the view range is limited, all meshes which are shown are either in the cameras view or wouldn’t make a big difference if they are taken into account or not for rendering. I expect that 80% of the meshes will also move or change its rotation and that meshes are added/removed constantly.

I created a small playground which contains way more meshes then in my actual scene but it shows the problem I have:

What I tried:

  • doNotSyncBoundingInfo = true
  • alwaysSelectAsActiveMesh = true
  • skipFrustumClipping = true

But I still get mesh selection time of 4ms which is for the 240fps target I have too high (I would actually expect it to be at 0ms).

Adding something like that (just testing if that would help in some way) actually removes the selection time but creates problem that sometimes the meshes disappear:

    setInterval(() => {
      scene.unfreezeActiveMeshes();
      setTimeout(() => {
        scene.freezeActiveMeshes(true, undefined, undefined, true, false);
        scene.skipFrustumClipping = true;
      }, 50);
    }, 1000);

Am I understanding something wrong that alwaysSelectAsActiveMesh should actually reduce the time spent there by a lot since all meshes have that set?

In fast mode of Snapshot Rendering, _evaluateActiveMeshes is completely skipped, see the code below:

That indeed disables it completely, but then the meshes do not move/rotate and it does work only on webgpu, is something like that possible in webgl too?

if you call this, you should not have ANY time spent on the evaluateActiveMeshes

scene.freezeActiveMeshes(true, undefined, undefined, true, false);

Disable mesh selection | Babylon.js Playground
image

But as you are moving meshes around, it forces the system to reevaluate the World Matrices (which is expected as you move them :))

2 Likes

snapshot is a Webgpu feature

Yes thank you that was what I was searching for