Hi,
I’ve got a very specific problem.
Don’t ask me why but I need to create a large mesh but whose vertices covers a very smal part of it.
In other terms, vertices are far from the pivot point but are forming a very small surface.
The mesh in question is a simple face which I create this way (part of the code) :
...
m = new Mesh();
///focus on that part
float width = 10000;
float width2 = 0.01;
float length= 10000;
float length2 = 0.01;
///
int widthSegments = 3;
int lengthSegments = 3;
float scaleX = width2/widthSegments;
float scaleY = length2/lengthSegments;
int hCount2 = widthSegments+1;
int vCount2 = lengthSegments+1;
for (float y = 0.0f; y < vCount2; y++)
{
for (float x = 0.0f; x < hCount2; x++)
{
///focus on that part
vertices[index] = new Vector3(x*scaleX - width/2f, y*scaleY - length/2f, 0.0f);
///
uvs[index++] = new Vector2(x*uvFactorX, y*uvFactorY);
}
}
index = 0;
for (int y = 0; y < lengthSegments; y++)
{
for (int x = 0; x < widthSegments; x++)
{
triangles[index] = (y * hCount2) + x;
triangles[index+1] = ((y+1) * hCount2) + x;
triangles[index+2] = (y * hCount2) + x + 1;
triangles[index+3] = ((y+1) * hCount2) + x;
triangles[index+4] = ((y+1) * hCount2) + x + 1;
triangles[index+5] = (y * hCount2) + x + 1;
index += 6;
}
}
Vector3[] vertices2 = vertices;
m.vertices = vertices2;
m.uv = uvs;
m.triangles = triangles;
m.RecalculateNormals();
meshFilter.sharedMesh = m;
m.RecalculateBounds();
...
This result in a mesh which isn’t displaying correctly.
See the print screen :

It seem like vertices are not well in line. Also they are like moving as camera move around ( as if there was an animated noise on it)
Here the ratio [distance from the origin (width)] / [actual surface size ( width2 )] is of 1:1000000.
If I set this ratio to 1:100000 ( width = 10000 and width2 = 0.1( instead of 0.01) ), then the mesh is correct.
I’m talking about ratio because what ever the size you try, the result is the same as long as the ratio is the same.
Could someone explain to me what is happening to my mesh, is it a normals issue ?