Question by
EternalClickbait · Aug 26, 2019 at 08:40 AM ·
meshproceduraltriangles
Triangles become black when flipping triangles
I'm developing a procedural terrain generator using Marching cubes, and whenever I try to make my meshes double sided, I get tonnes of black triangles on the mesh.
With double sided enabled:
Without double sided enabled
All I am doing in my script is adding the reversed triangles;
triangles.AddRange(meshDatas[m].triangles.AsEnumerable().Reverse());
or
//Get a copy of our triangles so we don't modify the original
int[] trisCopy = triangles.ToArray();
//Loop over each set of triangles
for (int t = 0; t < trisCopy.Length; t += 3)
{
//Swap them around
int temp = trisCopy[t + 0];
trisCopy[t + 0] = trisCopy[t + 1];
trisCopy[t + 1] = temp;
}
//Now add the swapped triangles
triangles.AddRange(trisCopy);
screenshot-253.jpg
(394.5 kB)
screenshot-254.jpg
(233.4 kB)
Comment
Your answer
Follow this Question
Related Questions
Generating Mesh using Points 1 Answer
Triangles for sphere 0 Answers
Best way to cycle through different generation settings? 0 Answers
URGENT How to get triangles of mesh in world space? 0 Answers