2

I'm trying to implement marching cubes on octrees. Here is a 2D drawing of what I am trying to figure out, it'll be easier to explain:

marching cube - octree

Each node of the octree represent a square in the plane (or cube in space), and stores a value for the potential on which I run the marching cube algorithm.

Now, the octree isn't built on the data set (the potentials in space), but it is built at runtime to give details wherever I want, and branches can be unloaded / loaded to change detail zones (zoom on the model for example)

Each node contains 4 references to children, which are a subdivision of the space of the actual node. (8 in 3D-space)

Now, I would like to use a marching cube algorithm to render my mesh (for example, a sphere) with parts that will be more or less detailed.

It's pretty easy to do the MC algorithm on a node that contains 4 empty children (I'll refer as empty children as child that only have a potential value, but no other children. they are not drawn on the tree, but they are in black on the right drawing) because I already have my potential values in a square (or cube for 3D space) (orange here) and can create a mesh inside (yellow) with one pass of the marching cubes algorithm

Now, my problem is that I can't figure out how to fill the gaps between the so-made meshes.

My thoughts were to recursively call a GenerateMesh() method in the tree, and each children will return to his parent the useful data so that the parent can fill the gaps, and return the new useful values for his own parent, etc...

But I can't figure out how to deal with different level of details (for example, the red cell would have to combine meshes from the top-left cell that is a 2x2 grid, and the top-right cell that is 4x4

I've already searched a lot online, but most of the papers I've read on the subjects explain theory and not how to deal with this.

How could I solve this? Do you have any references to detailed ways of doing it?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • MC algorithms of this sort are built on the assumption that you will use the same resolution for entire meshes if I understood your question correctly. They aren't designed to produce seamless results across variable resolutions (otherwise your triangle lookup table will be enormous). They are designed for fixed-resolution grids rather than variable-resolution octrees, so to speak, although you can use an octree to quickly determine if a grid cell is occupied without having to actually store every single individual grid cell at the lowest leaf level. –  Nov 11 '21 at 15:50
  • You don't merge gaps, so to speak, between different LODs. You use the same LOD for the entire mesh with a uniform-resolution 3D grid for it where cells are either occupied/not. If you want to seamlessly stitch together different grid resolutions using some variation of MC, that's like a whole new research project. I can't begin to imagine how to do it at MC level. You might be able to do it at the polygon level of the MC results detect non-manifold boundaries and bridge them with neighbors. That seems really complicated though, although pretty cutting-edge if you can pull it off at high FPS. –  Nov 11 '21 at 15:56
  • Well, now I'm all curious. I'm wondering if you can create a LUT that isn't too explosive to generate triangles seamlessly bridging double-resolution grids with half-resolution grids. Then you can apply some level of LOD on a sub-mesh level. –  Nov 11 '21 at 16:07

1 Answers1

2

There is the Transvoxel algorithm (https://transvoxel.org/). It's a modified version of the marching cubes algorithm that uses addition lookup tables, to create new so called transvoxels for seamless transisions between different LODs. In its current form though, it only allows for seamless transitions between LOD with double/half resolution, so you would still have to deal with that.

larsstifi
  • 21
  • 2