Jump to content

Using octrees... tutorial follow-up questions


jdurrant
 Share

Recommended Posts

I'd like to use octrees to optimize my test application. I read the helpful tutorial here: https://github.com/BabylonJS/Babylon.js/wiki/Optimizing-performances-with-octrees

 

I just have a few follow-up questions.

  1. According to my understanding of octrees, it should only be necessary to calculate them once on a given set of points. But the function name that BABYLON.JS uses to create octrees is "createOrUpdateSelectionOctree,” making me wonder if I need to update the octree periodically (perhaps in the render loop) for some reason. Am I right in thinking that I can just run “scene.createOrUpdateSelectionOctree(capacity, maxDepth)” once after my scene is created, as long as I don't add/remove/translate/rotate any objects after that? Does moving the camera require that I update my octree?
  2. Am I right in thinking that scene.createOrUpdateSelectionOctree creates an octree of the object position vectors (not the vertices of the all individual meshes)? A scene octree is used only for determining draw order during rendering, then, not collisions and picking? Is it used for level-of-detail updates?
  3. On the mesh level, is using mesh.createOrUpdateSubmeshesOctree the same as using mesh.useOctreeForCollisions + mesh.useOctreeForPicking + mesh.useOctreeForRenderingSelection?
  4. Am I right in thinking that createOrUpdateSubmeshesOctree must be called separately on instances, since instances have different vertex locations?
 

Thanks for all your help with this!

 

Link to comment
Share on other sites

Hey!

 

2.Correct: scene.createOrUpdateSelectionOctree is used to help finding visible meshes

3. mesh.createOrUpdateSubmeshesOctree is used to help collisions, picking and submeshes selection based on mesh.useOctreeForCollisions, mesh.useOctreeForPicking, mesh.useOctreeForRenderingSelection. Only one octree per mesh that can be used for all tasks. but beware. The mesh has to have a lot of submeshes to be efficient with Octree.

4. Correct

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...