- Home /
Vertex count 10 times higher in Unity
Hi,
i know, its discussed here quite often and this question was asked several times, but what i came to understand from that is what is causing the problem, but not the solution. My model has 300 vertices in Max, but in Unity its like 4000 vetices ??? I realy dont know what i should do about this. The model has to be textured way it is textured, so making less uvs is not option.
Is there realy no way around the vertex count, how to take the count in Unity close to the count in 3d modeling software ? Any help greatly appriciated ( any links to tutorials on this topic would be also welcome. By the way, how come that after countless hours spent with trainings for unity no one mentioned this ? )
Thanks
Luke
Answer by xandermacleod · Jun 06, 2013 at 10:53 AM
To be exact. The GPU automatically creates extra vertices in order to handle hard-edges, UV-splits and additional lights.
If a vertex is part of a hard-edge, then the vertex will have multiple tangents, normals and bi-normals. When a vertex is part of a softened edge, it only has 1 tangent, normal and bi-normal. Because for lighting purposes the GPU needs to perform a separate calculation for each tan/norm/bi-norm, it creates a new vertex for each. The same is true where there are UV-splits (these do not stack however, so if a vertex is on the edge of a UV-split and is part of a hard-edge it will not duplicate the vertex twice the amount). The number of vertexes in Unity will then be equal to the number of vertex-tangents the model has.
In addition to this for each additional render pass, the vertex count is added on top of the original vertex count. i.e 5 render passes on a 4000 vert model, for all intents and purposes equates to a 20000 vert model.
For more information, check out this helpful video provided by CGcookie:
http://cgcookie.com/unity/2013/04/18/understanding-gpu-vertex-count/
there's a good chance you might have told $$anonymous$$ax to make all of your edges hard-edges to get the kind of numbers you have. Try to always make the models have soft-edges, and then add back the hard edges sparingly where you need them.
can you please explain more you technique ? i mean when and where to add back the hard edges?
Answer by Bunny83 · Apr 29, 2011 at 09:00 PM
There's not a lot you can do. A Vertex in unity contains the position, the normal and the uv coordinates. A vertex that is shared in 3dsmax by 4 triangles will be splitted into 4 vertices if:
- it has a different normal vector
- it has a different uv coordinate
- it's part of a submesh because a different material should be applied to it.
It's hard to believe that 300 vertices will produce 4000. That would mean every vertex is used by around 13 triangles and every triangle have something special. What kind of mesh do you talk about?
thanks for quick reply. Its simple ship model, there is quite a lot separate objects, about 20 i guess, but those are all boxes and its all attached together and applied one material to the whole model ( multi subobject ). There are 3 textures and every object in model has uvs, of course. It is realy very low poly, i dont know what i did wrong, if the count was doubled, i would scratch my head, but it would be still ok, but 10 times more ?
i just tried to export simple cube with basic material and the vertex count is six times higher than in $$anonymous$$ax... ? I am realy confused.
6 times doesn't make much sense. A cube have the problem that you have 6 different normals for each side (otherwise the cube will look more like a sphere) That means each side have 4 vertices * 6 sides will result in 24 vertices. The highest amount would be 6 vertices per side (3 for each triangle) but even that would result in 36 vertices which is 4.5 times the original count (8). How do you import your model into Unity? I mean what export format do you use?
the cube has 8 vertices and in Unity it is 48 vertices. I use regular fbx export selected, i dont adjust any settings and just export.
I'm pretty sure there have to be something wrong in your workflow. I'm just a programmer so i can't give you any good advise regarding 3dsmax. Other people have similar issues but in most cases it's the common shared vertices problem. See this question: http://answers.unity3d.com/questions/30966/why-is-unity-got-more-vertices-than-3dsmax
Answer by cmyk3000 · May 20, 2016 at 03:52 AM
because Unity is not counting the geometry vertex but the UV vertex number.
Answer by sharbel · Oct 09, 2017 at 02:57 PM
Unity's realtime light (realtime shadows) adds calculation to each object affected by realtime light in the scene, which means it'll add more detail to it. You didn't do anything wrong in exporting. Just turn off the directional (or any other) realtime light and then check the Stats of your game scene. It should then correctly display the vertex count that you have.
Baking is a solution for that.
Answer by inpeckable891 · Nov 06, 2021 at 07:01 PM
For me, when I change my lighting from soft or hard shadows to no shadows, the vert count decreases dramatically. Also for some reason, the first(default direction light in every scene) light does not reduce vert count when deleted, but if you were to have multiple directional lights in your scene and deleted them, the vert count would decrease.
Your answer
Follow this Question
Related Questions
drawing vertices 1 Answer
What are some practical ways performance-wise to get a set of vertices in an area? 1 Answer
City model for iOS game. 1 Answer
Editing vertices 1 Answer
Checking If A Triangle Is In A Mesh 1 Answer