I’m in the process of creating a script that generates a mesh. The mesh will cover the top surface of several side-by-side cubes, and if the cube does not have a neighbor on a given side (right, left, forward, backward), it should get a rounded lip. I have the script up and running, and it works well. However, I have noticed that the rounded lip has uneven lighting.
To achieve the rounded lip, I’m creating 6 vertices. Example:
Vector3[] verts = new Vector3[] {
new Vector3(0, 0, 0),
new Vector3(0, 0, .1f),
new Vector3(1, 0, .1f),
new Vector3(1, 0, 0),
new Vector3(0, -.1f, .1f),
new Vector3(1, -.1f, .1f)
};
And then using these shared vertices, I create two quads.
int[] tris = new int[] {
0, 1, 2, 2, 3, 0,
1, 4, 5, 5, 2, 1
};
When I build the mesh, everything is fine except that the lighting is uneven on either end of the rounded edge. Here are some screenshots of what’s happening (these are side-by-side rounded lips that were created in the mesh).