Marching Cubes normals Issue
hi ! I have a marching cubes mesh creator algorithm but I'm having issues with the normals of my triangle as you can see here : ![alt text][1] ![alt text][2] [1]: /storage/temp/193063-1.png [2]: /storage/temp/193064-2.png
it seems that the triangles are facing the wrong way. However, I have no idea what I did wrong, considering I mainly took Sebastian Lague implementation and his implementation is good. Basically, here is the code that I think is guilty :
for(int i = 0; triangulation[cubeIndex, i] !=-1; i += 3)
{
int a0 = cornerIndexAFromEdge[triangulation[cubeIndex, i]];
int b0 = cornerIndexBFromEdge[triangulation[cubeIndex, i]];
int a1 = cornerIndexAFromEdge[triangulation[cubeIndex, i + 1]];
int b1 = cornerIndexBFromEdge[triangulation[cubeIndex, i + 1]];
int a2 = cornerIndexAFromEdge[triangulation[cubeIndex, i + 2]];
int b2 = cornerIndexBFromEdge[triangulation[cubeIndex, i + 2]];
newVertices.Add(interpolateVerts(cubeCorners[a0].position, cubeCorners[b0].position));
newVertices.Add(interpolateVerts(cubeCorners[a1].position, cubeCorners[b1].position));
newVertices.Add(interpolateVerts(cubeCorners[a2].position, cubeCorners[b2].position));
newTriangles.Add(newVertices.Count - 3);
newTriangles.Add(newVertices.Count - 2);
newTriangles.Add(newVertices.Count - 1);
}
Interpolate Verts only return the middle of the two points. Any idea on what my be my issue ?
Your answer
![](https://koobas.hobune.stream/wayback/20220613053427im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Drawing a plane facing upwards 0 Answers
Why flipping triangles, not normals 1 Answer
Some triangles are black on a mesh generated by script 1 Answer
Normals and triangles 0 Answers
Vertex Coloured Shader for trianges. 1 Answer