Jump to content

Use freezeActiveMeshes as soon as possible


Janx
 Share

Recommended Posts

Hi,

I have trouble with the mesh selection phase, which takes too long and therefor causes frame rates around 30 FPS. My scene contains roughly 2000 meshes, most of them empty (just used as containers or transformations). I do not know, if that is considered too much. Anyhow, using freezeActiveMeshes (thanks for adding this) to disable the mesh selection phase solves my problem, because the actual rendering of the scene is quite fast, even with all meshes activated. I therefore want to unfreezeActiveMeshes whenever the scene was changed and to freezeActiveMeshes as soon as possible. I thought using the onAfterActiveMeshesEvaluationObservable was a good idea to get informed when the mesh selection phase is completed, but using freezeActiveMeshes in the callback causes the engine to stall completely. You can see this here: https://playground.babylonjs.com/indexStable.html#0WHH9Q#5 Disabe the callback and it works: https://playground.babylonjs.com/indexStable.html#0WHH9Q#6

What is going on? Am I misusing the onAfterActiveMeshesEvaluationObservable?

Cheers,
jan

Link to comment
Share on other sites

Awesome, thanks for the quick support! @Gijs @Deltakosh I was not aware of Transformation Nodes and will start using them right away. @trevordev Thanks for the idea. Looking at the code of freezeActiveMeshes it is absolutely correct, that it notifies the onAfterActiveMeshesEvaluationObservable again. So I came up with a check in the callback whether freeze was already requested: https://playground.babylonjs.com/indexStable.html#0WHH9Q#7 I like this approach a bit more, since than again calling unfreeze is enough to update the scene.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...