1

I'm trying to implement a voxelization algorithm. I successfully implemented cube triangle intersection test and made a basic voxel model from discrete box meshes. However I can't find any information on how the merging is done between the separate box meshes to create a unified mesh. A naive approach I can think of is for each face of the cube check if it overlaps with any other face, delete both faces and stitch the edges around the faces between cubes. But this seems very crude.

Is there an algorithm for doing this?

Lenny White
  • 516
  • 2
  • 13
  • I don't know how your end result should look like, but to visualize volume data you could implement the "marching cubes" algorithm. Beware, the result is not minecraft like... an alternative is: first store the information about all filled voxel. When this step is done, you can iterate through all voxel and create the cube mesh. where for each face of the cube you need to check if the corresponding voxel is empty. – Thomas Sep 29 '20 at 09:41
  • I have looked at marching cubes algorithm previously. And it seems it generates different combinations of triangles from vertices you create at cube edges https://www.cs.upc.edu/~virtual/SGI/docs/1.%20Theory/Unit%2010.%20Volume%20models.%20Marching%20Cubes/Marching%20Cubes.pdf. But are you saying there's an alternative to create voxelized(minecraft like) mesh instead? I'm sorry I can't follow the steps you mentioned, it's a bit too vague. – Lenny White Sep 29 '20 at 11:47
  • what exactly is the problem? Is the problem to delete the "inner" faces of two neighboring cubes? or to have each vertex once, so two neighboring cubes share one vertex? – Thomas Sep 29 '20 at 12:03

0 Answers0