0

What I want is to re-triangulate a mesh by 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 is the iso-surface 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 find the right itnersection points between the isosurface and the voxels, because seems to have a 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.

bland
  • 1,968
  • 1
  • 15
  • 22
maria
  • 467
  • 1
  • 5
  • 19
  • Your input is a mesh from a voxel model, right? And what do you mean exactly by re-triangulating this mesh (how should your output mesh have improved when compared to the input one)? – user3146587 Feb 04 '14 at 21:37
  • The output mesh is not improved compared to the original. I just have a project at my school to re-triangulate a mesh using the voxel data and then compare the new triangulation with the initial one. – maria Feb 04 '14 at 21:44
  • 1
    You could try a simpler object, e.g. a sphere - this way you'll easily see a typical cubes that lack any triangles. I used the same method and it helped me a lot. If you show us some screens of a sphere rendered in your code I could tell you more about your problem. – kolenda Feb 13 '14 at 12:32
  • Edited. Hope it helps :/ – maria Feb 13 '14 at 16:03
  • 1
    According to your last edit it seems that MCs algo has this problem in itself. There are some combinations, where MCs doesn't create correct mesh. You can google for "ambiguous cases", there are many solutions for this but they are quite complicated, the easier one is to cap the potential holes with additional triangles, but this way you break the topology of your mesh. I'm still working on my own solution for this. – kolenda Feb 20 '14 at 13:25
  • It's a thread 2 years ago.... – maria Jul 07 '16 at 14:41

1 Answers1

1

First of all - you need to know why and how do you want to re-triangulate your mesh. Voxel based meshes have 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 really 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 point representing a tip of a mountain and some circular lines around it - those lines represent constant height, which means that when you go for a trip along such line, you'll not change your height over the sea.

Wiki example

Now, when you move from 2D to 3D then 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 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 kind of 'density' of your object, which basically means that voxels inside of a mesh have value 1 while voxels outside have value 0.

BTW: 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 more specific problem.

kolenda
  • 2,741
  • 2
  • 19
  • 30
  • I guess when you said that marching cubes extract an ugly surface you didn't mean something like that, right?? https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/v/t34/1898986_10152238110344063_1045393450_n.jpg?oh=7dcbb5ac9883d46dd44d430878bb8dab&oe=52F97905&__gda__=1392094483_f0b86843b4797fb6c747114c93848b1c this supposed to be a unicorn :O – maria Feb 09 '14 at 18:49
  • (I mean that there is a mistake somewhere in my code) – maria Feb 09 '14 at 18:51
  • It seems you have something wrong, because the space used by your cubes shouldn't overlap. Maybe try with some simpler data to see how does you code work. – kolenda Feb 09 '14 at 23:19
  • kolenda: I have updated my initial question, I would be very happy if you checked it! – maria Feb 12 '14 at 19:42