Making triangle mesh gradient smooth

mesh

I am making a mesh with multiple triangular faces where every vertex has a value that determines its color. It looks fine from a distance but when I zoom in, the lines of the triangles are visible because the gradient is not smooth between them.

mesh_zoom

The mesh is made from elements with 15 points that are connected into 16 triangular mesh faces.
I’m wondering if it matters to the gradient how I’m connecting the triangles. The following picture roughly demonstrates how each triangle in an element is connected.

triangleformat

And here is the code for the mesh face structure:

connectivityStruct = new List<int[]>();
            connectivityStruct.Add(new int[] { 0, 5, 1 }); // right bottom corner
            connectivityStruct.Add(new int[] { 1, 5, 6 });
            connectivityStruct.Add(new int[] { 1, 6, 2 });
            connectivityStruct.Add(new int[] { 2, 6, 7 });
            connectivityStruct.Add(new int[] { 2, 7, 3 });
            connectivityStruct.Add(new int[] { 3, 7, 8 });
            connectivityStruct.Add(new int[] { 3, 8, 4 }); // left bottom corner
            connectivityStruct.Add(new int[] { 7, 11, 8 }); // row 2 left -> right
            connectivityStruct.Add(new int[] { 7, 10, 11 });
            connectivityStruct.Add(new int[] { 6, 10, 7 });
            connectivityStruct.Add(new int[] { 6, 9, 10 });
            connectivityStruct.Add(new int[] { 5, 9, 6 });
            connectivityStruct.Add(new int[] { 9, 12, 10 }); // row 3 right -> left
            connectivityStruct.Add(new int[] { 10, 12, 13 });
            connectivityStruct.Add(new int[] { 10, 13, 11 });
            connectivityStruct.Add(new int[] { 12, 14, 13 }); // top corner

Does anyone have an idea to fix the gradient?

Hello - You can try Weld and see what happens… It looks like maybe the small triangles are welded within each larger one but the larger ones are not.

-Pascal

1 Like

Perfect, thank you! I hadn’t discovered the Weld method.