Vertex count increase unexpectedly on import.

Greetings

I have created a box (cube) in 3dMax. This box has according to 3dMax 8 vertices. I export it using OBJ or FBX like always and import it into unity.

When i attach this script to it

// Use this for initialization
void Start () {
	
	mesh = ((MeshFilter)GetComponent(typeof(MeshFilter))).mesh;
		
	Debug.Log("Vertex Count: " + mesh.vertexCount + " Vertices: " + mesh.vertices.Length + " Triangles: " + mesh.triangles.Length + " Normals: " + mesh.normals.Length + " uv: "+ mesh.uv.Length);
}

it outputs:

Vertex Count: 24 Vertices: 24 Triangles: 36 Normals: 24 uv: 24

Why is there suddently 24 vertices instead of 8?

Regards,
Marc

Because “vertices” in 3D applications and “vertices” in 3D graphics hardware are a bit different things. Whenever there are different normals, UVs, colors (anything) in your vertex - it’s a new vertex already.

A cube seems like it has 8 vertices, but because usually the normals point in different directions (all edges are “hard”), it’s actually 24 vertices (six sides, four vertices each).

Here’s an attempt at a visual explanation. The normals (little arrows) are different, so the each corner has several separate vertices that just happen to be in the same position.

62120--2268--$cubeverts_470.png

1 Like

Thanks Aras for the explanation. Make sense now 8)

Is there a particular order of how it is determined which vertex coordinate goes into what index of the vertices array?

Say i import the standard box from 3dMax is the order defined by the format or is it just first read first put or?

Sorry for the vague description hope its understandable what i mean.

Regards,
Marc