Marching cube algorithm problem

Started by
5 comments, last by CodeReaver 11 years, 10 months ago
Hi,

I'm trying to make a voxel terrain with Marching cube.
I have read some info about this. But i still can't figure out what they mean with this.


class GridCell{
public:
float val[8];
Vector3f pos[8];
};



Whats the value of val[8] what does it mean where does it come from.


I'm using info from.
http://paulbourke.net/geometry/polygonise/
Hope someone can help me out :-).
Advertisement
val[8] are the isovalues of your surface at the eight vertices in a grid cube.

I'm not familiar with voxel terrain, however, in 3D animation and medical imaging your isovalues come from Metaball/Blobby algorithms and CT/MRI machines respectively. In other words, there's a computational step / algorithm you compute prior to marching cubes which generates a nice block of 3D data for you. This data becomes your isovalues in your grid of cubes. Then, you pick a target isovalue, run marching cubes against that target value, and it will generate a surface corresponding to that value from your data block.
Ty very much for the reply :-).

But i still dont get this. What are the values for val and how do i calculate them. To use them in this function.

D3DXVECTOR3 VoxelTerrain::VertexInterp(float isolevel, D3DXVECTOR3 p1, D3DXVECTOR3 p2, float valp1, float valp2) {
float mu;
D3DXVECTOR3 p;

mu = (isolevel - valp1) / (valp2 - valp1);
p = p1 + (p2 - p1) * mu;

return(p);
}



ty
nvm :D got it working. The problem was that i was working with bools thanks for the help
val contains the input data to the algorithm. Try evaluating a function like a metaball one at each point in a 3D grid and using that data.

Hi,

I'm trying to make a voxel terrain with Marching cube.
I have read some info about this. But i still can't figure out what they mean with this.


class GridCell{
public:
float val[8];
Vector3f pos[8];
};



Whats the value of val[8] what does it mean where does it come from.


I'm using info from.
http://paulbourke.ne...try/polygonise/
Hope someone can help me out :-).


The isovalue is what the value should stand for and I believe the Algorithm details (second paragraph) later on in the page describe what they are trying do in the example
Hi,

I'm trying to do the same sort of thing, but I'm getting a bit confused by the terminology. What exactly is an isovalue?

I currently have a cloud of points and a bounding box containing them. I intend to divide the bounding box into equal sized cubes, loop through the lot of them, eliminate the ones that don't contain any points and use the rest as input for the Polygonise function. Unfortunately, that only gives me input for XYZ p[8] in the GridCell and I don't know where to get the rest of the input.

EDIT: I should probably explain that I'm attempting to get an approximation of a convex hull that surrounds the cloud of points. I realise I won't get a perfect convex hull, but my goal is to get as close as I can. I'm hoping to get something like the nearest point on a grid to where the convex hull would be. Something that would be acceptable as a collision mesh.
EDIT: The edit button showed up, but now I can't delete.

This topic is closed to new replies.

Advertisement