Question

I want to compute the resulting surface mesh of platonic (or maybe archimedian) solids applied with a displacement map for each face. The mesh should show fine details of the displacement map and be watertight and manifold (for 3d printing).

For this, I thought about using CGALs implicit function 3d surface mesher. I would then map each voxel point to the corresponding face, apply a coordinate system transformation from the voxel space to the face and look up the height field of the face. I know how to build the transformation matrix for each face, so I thought about the following algorithm for testing if a voxel is contained in the solid:

  1. Find the face which is nearest to the point A
    • For the given point A, find the 3 nearest vertexes of the platonic (archimedian) solid by iterating all vertexes and compare the distance to A
    • Sort the 3 vertexes according the smallest index in the vertex array
    • Build an integer number (lexicographix index) out of the vertex indexes: (v[0]nn+v[1]*n+v[3]*1) where n is the number of vertexes
    • Iterate an array of tupples (lexicographix index, face) and find the face with the same lexicographic index
  2. Each face has a pre calculated transformation matrix and a height field. Apply the transformation matrix and look up the height field to know if A is inside or outside of the solid

I guess there exists much better solutions, especially for finding the right face? Another approach might be to not use a surface mesher but build the surface out of the faces: take the displacement map of each face and apply the transformation matrix to it to build a solid, but then I need to simplify each face mesh and union them somehow so that the result is watertight and manifold (and the faces should support holes if the displacement map has certain values), so I thought a voxel based approach with an implicit function is the most general tool.

Was it helpful?

Solution

The voxel based approach was not successfull: To many artifacts, to low resolution. I ended in creating 2d height maps, aplying a simplification algorithm to them, then projecting them onto the faces of the solid and finally merging the face meshs into one single mesh by a custom algorithm.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top