- Home /
Blender to Unity more vertices.
Hey, I ran into a problem recently where I see less vertices in Blender and more in Unity itself.
Blender - I see 384 vertices here.
Unity - but 4 times the amount in Unity.
Now, I've read I can use edge split but it raises the vertices amount to the amount I see in Unity. Is there a way to bring the amount down to 384 in Unity rather then bring it up in Blender? If not, any recommendations to how should I reduce the vertices amount in Blender? I've used Decimate modifier already.
Thanks in advance!
Answer by Bunny83 · Jul 30, 2018 at 06:24 PM
No, there isn't. Keep in mind that Blender is a modelling software that uses an abstract definition of a vertex. However on the hardware (your GPU) you have to provide the vertices as they are required. For example if two adjacent triangles which meet at a vertex have a different normal, UV coordinate, vertex color or any other vertex attribute than the other one the vertex need to be "split". This might be misleading because they never were the same vertex. A cube has 8 corners but it requires 24 vertices (4 vertices per face * 6 faces). There's no way around that since each face need a differen normal vector. If you only had 8 verices you would need to assign 3 different normal to the same vertex which is not possible.
Likewise UV coordinates. If you want to assign a different UV coordinate to a certain triangle / quad than to the adjacent triangle, you need to split the vertices as well, even when the two triangles lie in the same plane and have the same normal.
So you need to understand that those "384" is actually the wrong number. Modelling tools work a lot with abstractions since it's purpose is to make it easy to work with. For example a modelling tool may support "polygons" with more than 4 vertices and only count those polygons. However on the hardware we can only render triangles. So the triangle count is of course higher than the polycount. For example a Dodecahedron (as the name suggests) has 12 pentagons as "faces". However when you want to render such a mesh on your GPU you have to split each pentagon into at least 3 triangles. Also a dodecahedron has 20 vertices however if you want to render such a thing you need 5 * 12 verices (== 60 vertices).
Thanks for the detailed explanation! I've managed to bring it down from 1536 vertices to 300-500 with a few modifications.
Shame Unity 2018 brought back the 65,535 vertices limit per mesh. It's a pain in the ass when you are working with chunks.
Hmm? What do you mean? The $$anonymous$$esh class now can be switched to use a 32 bit index buffer. Just set the indexFormat to your desired format. When you import a mesh you can also choose the index format Unity should use. However if the mesh doesn't have more than 64k vertices it's better to keep the 16 bit.
ps this image of the mesh importer is from Unity 2018.1.3f1
ps: If you create $$anonymous$$ecraft like chunks with the 16k limit you could simply use smaller chunks / chunk sections. For example 8x8x8 ins$$anonymous$$d of 16x16x16. That leaves a worst cast vertex count per block of 128 which should be enough for most things, Though since we have support for 32 bit index buffers it would make more sense to use larger chunk sections like $$anonymous$$C.
Note that when it's ok to limit your game to state of the art hardware you could use geometry shaders and render a single quad with a single inco$$anonymous$$g vertex. Parameters like size and orientation could be encoded in one of the UV channels. Of course that would restrict the usage to quads but it would save bandwidth and vertices.