maria
maria

Reputation: 467

marching cubes algorithm - seems triangles are missing

I want to re-triangulate a mesh using the voxel model I have created.

From a Google search, I found that Marching Cubes should be a suitable algorithm. I have read many tutorials but the iso-surface part confuses me.

I follow this tutorial http://paulbourke.net/geometry/polygonise/ but cannot understand what exactly the iso-surface is in my case and how to extract it.

Is it my initial object surface?

EDIT1:

So far I have done this with the re-triangulation:

re-triangulated object

It seems that I found the right intersection points between the isosurface and the voxels because it seems to have the right voxel model:

voxel model

But why they are missing so many triangles at the re-triangulation?

EDIT2:

Debugging my code, I noticed the following: The Marching Cube table I use has pointers to the vertices where the iso-surface cuts my voxels. These triplets construct the new triangles. But I noticed that many times the Table says to construct the triangle with the vertices (for example) intersection_point(0)-intersection_point(3)-intersection_point(5) but my intersection points are at different positions.

-> The position of the intersection points depends on the edge where they lie.

Upvotes: 0

Views: 2305

Answers (1)

kolenda
kolenda

Reputation: 2801

First of all - you need to know why and how you want to re-triangulate your mesh. Voxel-based meshes have a specific look, so if you just want to simplify your triangle/vertex count or mesh topology then voxels are NOT the way for your needs - they will just break your mesh and make it ugly.

However, if you want to have voxels then let's see what are we talking about...

In general an 'iso-something' line/surface is a line/surface along which our 'something' is constant. Let's imagine a map of a mountain - you have a point representing the tip of a mountain and some circular lines around it - those lines represent constant height, which means that when you go along such line, you'll not change your height over the sea.

Wiki example

Now, when you move from 2D to 3D, the 'line' is replaced by 'surface', and everything stays the same. Let's take a light bulb as an example - assuming that the bulb lights constantly in each direction and knowing, that the closer you get - the temperature rises, then each sphere centered on the bulb will be its 'iso-term' surface. The example with just one light bulb is quite trivial but when you have more of them then the surface gets more interesting and this is the perfect example of using Voxel fields and the Marching Cubes algorithm.

All those examples used some physical values and may be misleading in your exact case, but when you need to voxelize a mesh you just assume that you store some 'density' of your object, which means that voxels inside of a mesh have a value of 1 while voxels outside have value 0.

BTW: A few months ago I implemented my own Marching Cubes that didn't use any static tables but computed everything in code so I could help you with some details if you have a more specific problem.

Upvotes: 1

Related Questions