# How to smooth a voxel mesh?

Currently I have refined voxels, I want to smooth it to achieve accurate projection. After some web search, I came across smoothing algorithms such as Catmull-Clark, Doo-Sabin etc. Along with this, I read one should need the connectivity information to use smoothing algorithm on the outer face of voxel and the connectivity information can be established using the Half edge data structure.

I understand that I need to feed voxel data to Half edge data structure so that I can proceed with a further step but the thing is I didn't get proper idea to use CGAL's Half edge data structure. Moreover, the documentation didn't help me much. Can someone help me to figure this out?.

For example, I have taken sphere as input geometry (First Image). After voxelization, I used intersection algorithm to identify boundary cells which represent actual input geometry as you can see in the above image. Either we can take voxels outside boundary or inside the boundary for projection. Since projecting inside voxels on the surface mesh is quite easy. So directly by using ray shooting on refned voxels, I identified those voxels which are inside boundary voxels. Inside voxels also represents geometry which also looks like in middle image.

From middle Image, we can see that the size of the cells varies from one to another. I want to identify outermost faces from it so that I can use a smoothing algorithm to eliminate Cartesian front to achieve accurate projection.

• I don't think this is the right algorithm to use for the purpose. Half-edges are quite fussy to work with, and the typical voxel system already has adjacency information from the voxel grid itself! Can you show us what your "refined voxels" look like, and how you generate them? Aug 19, 2020 at 11:09
• Comments are not for extended discussion; this conversation has been moved to chat. Aug 25, 2020 at 14:18

Do you have any data beyond "solid" vs "not solid" for each voxel? If you have continuous data, such as from the squared distance function that yields the sphere, you can use an isosurface extraction algorithm such as Dual Contouring.

If you don't have this data, you could try to come up with a method of producing it given the voxels (e.g. blurring), but it might alter the locations of the boundaries.

• Check the linked chat thread. They're using this technique to try to make a water-tight version of an input mesh. So first they voxelize the mesh, form the water-tight outer surface of the voxels, then want to project the voxel vertices so that the water-tight mesh closely follows the input mesh. I'd recommended dual contouring in the conversation, but it's not applicable in this case. Jan 13, 2021 at 13:09
• Good point! I see now. Interesting problem. Jan 13, 2021 at 13:17

KdotJPG brings up a very good question. Is the volumetric data simply 0s and 1s, or are there intermediate values allowed as well?

Are you using Marching Cubes to convert the density data to triangles?

There is Taubin smoothing. However, smoothing in general can magnify flaws in meshes. For instance, if you're using Marching Cubes, and you do NOT sort the input vertices/density values, then the mesh will inevitably suffer from cracks.

So, are you using Marching Cubes?

You may see my code at https://github.com/sjhalayka/meshdim In particular https://github.com/sjhalayka/meshdim/blob/d69c0e13998ed9a96f8aa652cd54080556814b12/mesh.cpp#L849