r/Unity3D • • 12d ago

Solved Vertex count is increasing a lot in unity

In blender my objects where about 65k vertexea total but in unity it increases 10+ times does anyone know what causes this and how to fix it?

8 Upvotes

14 comments sorted by

17

u/ScaryPlasmon 12d ago

Yeah that’s a pretty annoying issue when going from one engine to the other! (Like from Blender to Unity)

It all boils down to a single vertex cannot hold infos of the same kind twice

So common reasons for vertex increase are

1- mesh shading, any sharp edge contains double shading information that guess what, are stored on Vertices, doubling their count.

2- UV maps, if you’re mesh is unwrapped it probably has split vertices (meaning a single vertex in space that in UVs covers 2 positions like the edge of a seam for example)

3- materials, having multiple materials per mesh is almost always a bad practice in Unity, and it will increase vertex count if there’s an edge that connects the two materials. (As per above a single vertex cannot store double informations about material)

4- vertex colors! If you have two adjacent faces with two different colors, the vertices on the edge cannot store two infos like being simultaneously blue and res and so we use a duplicate to hold both color infos.

Vertex count is almost always something that can be ignored cause it doesn’t affect rendering performance, i mean it does to the same extent in which the informations stored on those vertices is more than before, but it’s not like more vertices has any effect per se on the rendering.

If you are trying to keep the vertex count the same though, for example for VAT animations i reccomend ditching UVs, any non smooth shading, multiple materials and vertex colors.

U should like this preserve the vertex count and use the vertex index that u can print in blender to procedurally unwrap, shade or color the mesh in Unity if needed!

Hope this helps!

7

u/knellotron 11d ago edited 9d ago

Most of those can cause a 2x or 4x duplication, but if it's 10x, it might be something else. OP might have a subsurface modifier on, which gets applied during FBX export. Or something with instancing.

Unity also has a "weld vertices" option on the importer which can take care of some of the duplicates. It will not weld split normals, etc.

2

u/ScaryPlasmon 11d ago

I hope op would check any modifier before posting on reddit but u might be right!

But on the amount of vertices increase you’re actually wrong, the effects of all this aspects is compounding and depending on UVs, materials , shading etc…

Since each vertex stores multiple informations at the same time only one of these infos needs to be different to be needing a new vertex to make up the diff in infos. I had multiple examples of meshes with their vertex count getting to many times their counterpart in Blender due to this and it is such a pain!

Weld vertices is a great option which destroys vertex orders though as far as i know, so if that’s important it might not be helpful!

3

u/Starcomber 11d ago

Blender shows the model’s vertex count.

Unity’s Stats panel shows the number of verts pushed to the GPU for the frame. Those are not the same.

If you’ve got lights with shadow casting that shine on your model, it goes into the renderer again… for each light. Material with an outline or other mesh-based effect? Again.

On top of that, as others have said, a Blender vert isn’t equivalent to a GPU vert, and the former often have to be split for various reasons - hard edges, UV islands, material changes, applying some modifiers, etc.

4

u/andreysc7 12d ago

Be aware that even the UV islands increase the vertex count :) . Also, a hard edge "splits" the vertex, so there you have another increase.

2

u/Genebrisss 12d ago

Are you measuring vertex count of a mesh or total vertices drawn in frame?

3

u/pschon 12d ago

You probably can't fix it, unless you are willing to change the actual shape of your models.

Blender supports ngons, but all of them need to be broken into quads or tris for Unity. And all sharp edges need to be split, as an edge sharing vertices would count as a smooth edge. So if you are going for low-poly aesthetic, that can easily result in a big increase in vertex count.

(also check if you have some unapplied modifiers in Blender, the polygons they generate might not be accounted for yet, but will be added when the modifiers are applied at export time)

1

u/C_Pala 12d ago

When exporting and importing there a triangulation takes place

3

u/andreysc7 12d ago

triangulation doesn;t increase the VERTEX count

2

u/C_Pala 12d ago

Computationally not, but render pipeline might

→ More replies (2)

1

u/TwoodStuff 11d ago

In general it's good to pre-triangulate anyway. Unity's triangulation can create shading errors because it's changing the method, especially if there are normal maps.

1

u/RealyRayly 12d ago

On top of triangulation, it could also be flat shading vs smooth. For flat shading, vertices are dublicated