# Degenerate case of normal computation in marching cubes

I'm implementing the marching cubes, reference is this. I managed to get the geometric reconstruction (the mesh) however I do struggle with the normals.

In section 4 they explain the gradient can be firstly estimated using central difference using 8 cubes sharing the vertex $(i,j,k)$. However consider for example case 1 (figure 3) in the paper assume for example you have 8 cubes with one vertex "on" and all the other "off". All the central difference (assuming binary values) would give you 0, therefore I wouldn't be able to estimate the normal in the cube vertex, and later linear interpolate.

Is there some subtlety I'm missing? I wouldn't personally use central difference, but assuming I'm sweeping in a certain direction and then interpolate a point in a cube edge I would use for example forward difference, which to me make more sense, however I'm not 100% sure of the "sense" of this.

In their scheme they give a good explanation of why their approach make sense. Not sure I can justify mine.

The paper doesn't say to compute the normals for the 8 "cubes" around the cube in question. It is saying to compute the normals for all the vertices of the cube you are testing. To create those normals the algorithm would need density values from the surrounding cubes but not the normals of the surrounding cubes.

The paper labels those vertices v1 to v8. So if v1 is the only vertex whose density value is 1 and the density value for all 7 other vertices is zero then v3,v6,v7 and v8 would have normals of zero (assuming the adjacent cubes were empty). But v1,v2,v4 and v5 would have non-zero normals since v1 is guaranteed to have a non-zero density and at least 1 of x,y or z would be non-zero. Interpolating those normals to the triangle with vertices at e1,e4 and e9 should give a normal pointing roughly at v7.

When reading a paper like this one (ie one that has been used around the world to visualize life saving data, and help countless people) if I think I have found an error I stop and take a long hard look for my mistake instead of looking for the mistake of the authors. Just saying.

• You compute the normal "for each vertex of a cube" not "for a cube", my example case was to compute the normal for a vertex shared by 8 cubes, where such vertex is for example "on" and all the others "off". If you read the paper and use their formula you would get $(0,0,0)^T$ which doesn't make sense as normal. – user8469759 Jun 21 '18 at 9:29
• The paper specifically says that normals are only calculated for vertices that are "off", but which have a least 1 vertice in the cube that is "on". Calculating a normal for a vertice that is inside the volume doesn't make any sense. Put another way, if you follow the edges of every cube to all the connecting vertices and compute the normal that normal will be non-zero. – pmw1234 Jun 21 '18 at 14:37
• excuse me -- vertex (not vertice) – pmw1234 Jun 21 '18 at 14:47
• Say you have a point cloud consisting of only 1 point, and you want to estimate the normals that are on the mesh that surrounds that point, what would you do? (this is only applying case 1 given by the paper). – user8469759 Jun 21 '18 at 14:49
• Using case 1 from the paper:Compute the normal at v2 results in (1,0,0) compute the normal at v4 results in (0,1,0) ...interpolate the normal between v2,v4 the normal would start at (1,0,0) pass through (0.5,0.5,0.0) and end up at (0,1,0). The result would be a octahedron but would look like a sphere when rendered. Do the same for all the vertices ignoring results that are inside the volume or not connected to the volume – pmw1234 Jun 21 '18 at 15:30