0
\$\begingroup\$

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?.

enter image description here

enter image description here

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.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ 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? \$\endgroup\$
    – DMGregory
    Aug 19, 2020 at 11:09
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – DMGregory
    Aug 25, 2020 at 14:18

3 Answers 3

0
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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. \$\endgroup\$
    – DMGregory
    Jan 13, 2021 at 13:09
  • \$\begingroup\$ Good point! I see now. Interesting problem. \$\endgroup\$
    – KdotJPG
    Jan 13, 2021 at 13:17
0
\$\begingroup\$

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

\$\endgroup\$
0
\$\begingroup\$

I know I'm a little late but who cares

  1. I will warn you in case you are as stupid as I was, you cannot simply reuse vertices because it can lead to two cubes touching only corners or edges to share vertices, which makes calculating normals impossible.

  2. The easiest way to smoothen voxel mesh is interpolating between vertexPosition + vertexNormal and vertexPosition - vertexNormal like:

P0 = vertexPosition + vertexNormal;
P1 = vertexPosition - vertexNormal;
S0 = abs(f(P0) - t);
S1 = abs(f(P1) - t);
vertexPosition = (P0 *S1 + P1 * S0)/(S0 + S1);

where t is surface level and f is scalar field. for vertexNormal you can use average normals of adjacent faces or, for better effect, use gradient of scalar field, but usually the first one is good enough.

\$\endgroup\$
3
  • \$\begingroup\$ I forgot to mention that you should recalculate normals after smoothing the mesh \$\endgroup\$
    – Crimsoon
    Jun 4 at 12:05
  • \$\begingroup\$ You can edit your answer. \$\endgroup\$
    – Theraot
    Jun 4 at 12:22
  • \$\begingroup\$ I recommend reading the chat thread linked in the comments. The way the question is described in the question post does not accurately convey what this user was actually trying to do, which was to take an existing mesh and make a water-tight version by voxelizing it and then projecting the voxel mesh back onto the original triangle mesh surface. \$\endgroup\$
    – DMGregory
    Jun 4 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .