I generate some procedural meshes and I see really low quality and jittery mesh material. How could I fix this?
In game, poor quality material
Each quad (2 triagles) is 100 x 100 units
I generate my UV0 vertices like so:
UV0.Add(FVector2D(
(X + verticesArraySize),
(Y + verticesArraySize)
)); // BottomLeftIndex
UV0.Add(FVector2D(
(X + verticesArraySize),
(nextY + verticesArraySize)
)); // BottomRightIndex
UV0.Add(FVector2D(
(nextX + verticesArraySize),
(nextY + verticesArraySize)
)); // TopRightIndex
UV0.Add(FVector2D(
(nextX + verticesArraySize),
(Y + verticesArraySize)
)); // TopLeftIndex
I have some functions that wrap the generation details and I set the material for each section like so:
void AProcTerrain::GenerateMeshSection(int32 sectionIndex, FVector location)
{
GenerateGrid(Vertices, Triangles, Normals, UV0, Tangents, VertexColors, sectionIndex, location);
mesh->CreateMeshSection_LinearColor(sectionIndex, Vertices, Triangles, Normals, UV0, VertexColors, Tangents, true);
mesh->SetMaterial(sectionIndex, Material);
}