Mesh subdivisions in a grid-like style partitions

Hi all,

These days I’ve been trying to build a simple project in BabylonJS that involved a bit of vertex painting and moving vertices around from a very high poligon meshes and I’ve faced some performance issues that I’m slowly addressing (thanks to the supportive community I’ve found at the forums, that pointed me into the right way to get better performance).

One of the things that helped with that was the mesh.subdivide and mesh.createOrUpdateSubmeshesOctree() but then I’ve found a limitation of the subdivision system as it is based on a start index and an index count and not on a custom group of indices. In most cases, the meshes modeled in other software don’t have a very nice order in their vertices, so the subdivisions are a bit messy.

Then I found the grid-likee partitions that mesh.updateFacetData() provides and I managed to get the bounding boxes and vertex group for those partitions. The thing with that is that these partitions can not be threated as submeshes (I think) thus not getting the picking performance that you get with subdivisions and octrees.

Here you have a playground to show the visual representation of these partitions vs the submeshes:
https://playground.babylonjs.com/#UXHPXC#1

And the explanation of the thing in this post:

So, after this introduction, the suggestion I have is that may be interesting if the submeshes could be created natively (as an option to not break backward compatibility) using the partitions that the mesh.updateFacetData() provides. I’m very new to Babylon, webgl and all of this, so I’m not sure if that is even possible or if it will benefit in other use case scenarios.

Anyway, thank you to make 3D web programing accesible to the mass with this intuitive framework!

Adding @jerome to get his thoughts

I’m blocked at home for a while still and, here, I don’t have much time to code with BJS. So please, do every improvement that you find pertinent :slight_smile: