This implements the main unsubdivide algorithm which rebuilds a base mesh and extracts the grid's data from a high resolution mesh.
It includes the Rebuild Subdivisions operator, which generates all subdivision levels down to the level 0 base mesh.
What works:
- Rebuilding an arbitrary number of levels or as many levels as possible down to level 0 in a single step (not available in the main function, but very easy to enable).-
- Meshes with n-gons and triangles
- Base mesh made completely out of triangles
- Meshes without poles
- Meshes with multiple disconnected elements at the same subdivision level
What does not work:
- It is still not copying the data to the original grids, so it does nothing.
- The mesh should not have higher level grids. Merging the existing grids into the new ones should not be hard, but not a priority right now for importing. It can also be implemented with a delete lower operator.
- On meshes with quads sharing 2 edges it can't reconstruct level 0, it will stop at level 1 with two triangles (like Suzane). This is something that should not happen that often in a real use case.
The main function of the algorithm is ##multires_unsubdivide_to_basemesh##
It expects an already subdivided mesh (original_mesh) and it will output the level 0 base mesh and an array of ##MultiresUnsubdivideGrid## indexed per base mesh loop. These structs contain the coordinates in object space in the correct order to build the grid for each loop.