Friday, January 27, 2017

unity - How can I fix zig-zagging UV mapping artifacts on a generated mesh that tapers?



I am creating a procedural mesh based on a curve and the size of the mesh gets smaller throughout the curve as you see below.


enter image description here


And the problem is UV gets zig-zagged as the size changes (it works perfectly when the size of the mesh is same throughout the curve).


enter image description here


 Vertices.Add(R);
Vertices.Add(L);
UVs.Add(new Vector2(0f, (float)id / count));
UVs.Add(new Vector2(1f, (float)id / count));
start = Vertices.Count - 4;
Triangles.Add(start + 0);

Triangles.Add(start + 2);
Triangles.Add(start + 1);
Triangles.Add(start + 1);
Triangles.Add(start + 2);
Triangles.Add(start + 3);

mesh.vertices = Vertices.ToArray();
//mesh.normals = normales;
mesh.uv = UVs.ToArray();
mesh.triangles = Triangles.ToArray();


How can I fix this?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...