Sunday, July 24, 2005

Marching Cubes

I realized after reading through other research papers that implementing the Marching Cubes algorithm into my project would not be difficult. The octree data structure is ideal for adding the marching cubes technique.

The octree structure has branch and leaf nodes. The leaf nodes could be viewed as vertices rather than cubes. The leaf nodes are updated to reflect whether they are outside, are on the border or inside of the object. Each branch keeps track of 8 children and whether a child should be drawn. This reduces branches that need to be visited when drawing the object. If a branch has one child that is on the border, then the current branch should be drawn.

Source code was obtained that provides a lookup table with 256 entries. This is because there are 2^8 possible combinations. These can be reduced to around 15 general cases due to rotations but a lookup table lists all triangles that should be drawn for each case.

The triangles are formed using midway points between the vertices. There are 8 vertices for a cube and there are 12 midway points. These points are referenced in the lookup table. Normals can then be computed from the order of the midpoints.

0 Comments:

Post a Comment

<< Home


Counters