Hello! I’m creating an area graph with multiple 2d meshes. I’m trying to add a material with a gradient to each 2d mesh using uvs. It works for meshes with 4 or more points, but meshes with only 3 vertices are invisible. How can I fix this problem?
As you can see, all the meshes are drawn. However, the ones with only 3 points are not colored. The uvs for the first triangle (that doesn’t work) are (0,1), (0,0), and (1,1). The uvs for the third triangle (that does work) is (1,0), (0.66,1), (0.33,1), and (0,0). This is my first time posting, so if there is any information you need, let me know. Any help would be appreciated!
The meshes are triangulated using ear-clipping and the points are counter-clockwise, at least I think they are lol.
Well, first of all in Unity which uses a left handed system the winding order should be clockwise, not counter clockwise. Since you only “think” they are winding in a certain direction, I think you should clear that up because they may face into the wrong direction. However you can immediately check this by switching the camera into 3d mode and move it to the other side. If you see those missing triangles there, they have the wrong winding order. Though if you create those triangle from code, it should be quite easy to reason about the winding order when you pay attention.
Your screenshots of your vertices are not helpful at all since they are useless without the triangle definition. Also your meshes appear to be 2d meshes, why do your coordinates vary in all 3 axis? If they don’t it’s not really clear what those 3 values represent if it’s not x, y and z.
It’s also not clear how the texture actually looks like. Maybe you mapped an empty region? If you need further help with this, you should edit your question and add more details. Preferable the relevant code that generates the mesh or at least the exact vertex, uv and triangle data as text, not as an image.