jdurrant Posted March 16, 2015 Share Posted March 16, 2015 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.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?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?On the mesh level, is using mesh.createOrUpdateSubmeshesOctree the same as using mesh.useOctreeForCollisions + mesh.useOctreeForPicking + mesh.useOctreeForRenderingSelection?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! Quote Link to comment Share on other sites More sharing options...
Temechon Posted March 16, 2015 Share Posted March 16, 2015 Hello ! 1. You don't need to update it if nothing is moving, and you don't need to update it when moving the camera either. I don't know about 2, 3 and 4, but I'm sure someone can help you Cheers ! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 16, 2015 Share Posted March 16, 2015 Hey! 2.Correct: scene.createOrUpdateSelectionOctree is used to help finding visible meshes3. 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 Quote Link to comment Share on other sites More sharing options...
jdurrant Posted March 16, 2015 Author Share Posted March 16, 2015 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.