- Home /
why is Unity got more vertices than 3dsmax
Hi when I modeled the objects in 3dsmax and export them to FBX for Unity, the vertices count becomes nearly double... In Unity iPhone, to get the dynamic batching working, we have to restrict vertices to under 280 and even I modelled with 150 vertices in max, Unity double it up... What happened?
Answer by skovacs1 · Dec 09, 2010 at 03:32 PM
3DS Max will single-counts shared vertices with separate normals, but when importing, Unity will split per-vertex normals. If your mesh does not smooth the normals across vertices (smoothing groups), you will get an increase in vertices because each face will have each of its vertices with separate normals generate a separate vertex with a separate normal in the export rather than sharing the vertices with other faces. To resolve this, you should apply smoothing groups to your model, sharing smoothing groups across all smooth faces.
For example:
A plane with a pivot positioned at the lower-left corner can be defined as:
Vector3[] vertices = new Vector3[6];
Vector3[] normals = new Vector3[6];
Vector2[] uv = new Vector2[6];
int[] triangles = new int[6];
uv[0] = new Vector2(0.0f,0.0f);
uv[1] = new Vector2(0.0f,1.0f);
uv[2] = new Vector2(1.0f,1.0f);
uv[3] = new Vector2(0.0f,0.0f);
uv[4] = new Vector2(1.0f,1.0f;
uv[5] = new Vector2(1.0f,0.0f);
for(int i = 0; i < 6; i++) {
vertices[i] = new Vector3(uv[i]);
normals[i] = Vector3.forward;
triangles[i] = i;
}
or:
Vector3[] vertices = new Vector3[4];
Vector3[] normals = new Vector3[4];
Vector2[] uv = new Vector2[4];
int[] triangles = new int[6];
uv[0] = new Vector2(0.0f,0.0f);
uv[1] = new Vector2(0.0f,1.0f);
uv[2] = new Vector2(1.0f,1.0f);
uv[3] = new Vector2(1.0f,0.0f);
for(int i = 0; i < 4; i++) {
vertices[i] = new Vector3(uv[i]);
normals[i] = Vector3.forward;
}
for(int i = 0; i < 3; i++) triangles[i] = i;
triangles[3] = 0; //shared
triangles[4] = 2; //shared
triangles[5] = 3;
Notice how the exact same plane can have nearly double the vertices. Because the normals were not shared in 3DS max across the triangle faces, each face gets each of its vertices separated as in the first example. The same plane with a smoothing group across the two triangles or defined as the same face in an editable poly (essentially hiding the edge and smoothing the normals) will generate the second example.
Thanks... This really help me alot.. It can save double vertices and now my world can up to double the previous vertices count. :)
Using your explanation For each vertex in the mesh I count how many faces in different directions it has. This sums up well in my meshes.
Wanted to add that turning off the Light and the very recent "Allow HDR" on the Camera object also reduce vertex count on objects during runtime, which can be inspected in the "Stats" window.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Creating an octopus / squid that spits ink with a particle system? 1 Answer
Tessellation + total vert/tri count 0 Answers
Guy's that know the standard physics 1 Answer
hollow objects, hollow mesh? 1 Answer