Hi, I’m working on a project that needes improved performance when picking a certain area of the mesh and then selecting some surrounding vertices.
I’ve got a boost of performance adding subdivisions and octree to the mesh with model.subdivide() and mesh.createOrUpdateSubmeshesOctree(), and then using BABYLON.BoundingBox.IntersectsSphere with the submeshes bounding box.
But as the meshes I need to work on have a very high polygon count, this is still not quite efficient with the mesh partition that the “subdivide” function provides, because it’s based in a “vertex start” index and a vertex count (so, one after another) and not a user provided vertex list.
I’ve been trying to make partitions of the mesh with mesh.updateFacetData() and it does the grid-like partitions I was looking for, but I don’t know how to get these groups of faces/vertices into submeshes so I can put them into the octree in a performant way. Is this possible in some way within Babylon?
Here you have a small playground I’ve built with the left sphere showing the vertices in the submeshes and the right one showing the vertices in the facet partitions. I think it will be faster to loop through the vertices in the partitions than in the subdivisions when you need to check for vertices at a certain distance from a picked point (from scene.pick() for example), as the areas are smaller:
Maybe is there some way to get the bounding boxes of the partitions in the right sphere to do the intersection checks? And them into the octree for speeding up the picking?
Thanks in advance!