<p>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.</p>
<p>Is there an algorithm for doing this?</p>

CC BY-SA 4.0
2020-09-29T09:41:04.787Z
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
CC BY-SA 4.0
2020-09-29T11:47:23.360Z
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
CC BY-SA 4.0
2020-09-29T12:03:02.180Z
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
<voxelization>
How to merge voxels
Lenny White
# How to merge voxels

(Asked by: username_0 on 2020-09-28)

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?

**Tags:** voxelization

> **Comments:**
> **username_1**: 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.  
> **username_0**: 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.  
> **username_1**: 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?  

---

## 0 answers

