I’m sorry, but I don’t really know the proper term for this, and I’m assuming it’s some sort of overlapping/blend issue. I have a tile (attached tile.png), and I create a mesh with a bunch of these tiles as a background (attached issue.png and tiles.png might be more clear what the issue is). Also attached what the UV Checker looks like (uvchecker.png). And the material that I’m using has the “Unlit/Texture” Shader.
In issue.png, the yellow box is showing that these are rendering properly, but the black box is showing some sort of weird render issue where the white is predominant over the black that’s supposed be there. The output should be that all tiles are uniform and look like they do in the yellow box… no blending of white/black.
I was reading a couple of threads (mainly this one and this one), and shaders were mentioned in them, but I really don’t know if that’s what’s needed here. If someone could give me a clue if that is indeed the problem, that would help. I’m including my “AddToMesh” method that does the mesh building, but I’m not sure how helpful it will be:
public static void AddToMesh(
int index,
World.GridNode tile,
Vector3[] vertices,
Vector2[] uvs,
int[] triangles,
Color[] colors
)
{
Vector3 baseSize = tile.GetQuadSize();
Vector3 position = tile.GetWorldPosition();
float rotation = tile.GetRotation();
Color? color = tile.GetColor();
tile.GetUVCoordinates(out Vector2 uv00, out Vector2 uv11);
//Relocate vertices
int vIndex = index * 4;
int vIndex0 = vIndex;
int vIndex1 = vIndex + 1;
int vIndex2 = vIndex + 2;
int vIndex3 = vIndex + 3;
baseSize *= 0.5f;
bool skewed = baseSize.x != baseSize.y;
if (skewed)
{
vertices[vIndex0] = position + GetQuaternionEuler(rotation) * new Vector3(-baseSize.x, baseSize.y);
vertices[vIndex1] = position + GetQuaternionEuler(rotation) * new Vector3(-baseSize.x, -baseSize.y);
vertices[vIndex2] = position + GetQuaternionEuler(rotation) * new Vector3(baseSize.x, -baseSize.y);
vertices[vIndex3] = position + GetQuaternionEuler(rotation) * baseSize;
}
else
{
vertices[vIndex0] = position + GetQuaternionEuler(rotation - 270) * baseSize;
vertices[vIndex1] = position + GetQuaternionEuler(rotation - 180) * baseSize;
vertices[vIndex2] = position + GetQuaternionEuler(rotation - 90) * baseSize;
vertices[vIndex3] = position + GetQuaternionEuler(rotation - 0) * baseSize;
}
//Relocate UVs
uvs[vIndex0] = new Vector2(uv00.x, uv11.y);
uvs[vIndex1] = new Vector2(uv00.x, uv00.y);
uvs[vIndex2] = new Vector2(uv11.x, uv00.y);
uvs[vIndex3] = new Vector2(uv11.x, uv11.y);
if (color.HasValue)
{
// Set vertex colors
colors[vIndex0] = color.Value;
colors[vIndex1] = color.Value;
colors[vIndex2] = color.Value;
colors[vIndex3] = color.Value;
}
//Create triangles
int tIndex = index * 6;
triangles[tIndex + 0] = vIndex0;
triangles[tIndex + 1] = vIndex3;
triangles[tIndex + 2] = vIndex1;
triangles[tIndex + 3] = vIndex1;
triangles[tIndex + 4] = vIndex3;
triangles[tIndex + 5] = vIndex2;
}