Polycount inconsistencies between tris and vertex

Hello everyone I've been exporting a bunch of assets for iPhone and as most people I got surprised by the very high triangle count in the engine. I looked at some other questions there and there such as this one:

http://answers.unity3d.com/questions/1466/why-is-there-such-a-huge-disparity-in-polycount-between-unity-and-maya

I'm very aware of a lot of the tech weirdness in polycounts, but that doesn't explain everything imho. I understand both uv borders and hard edges increase vertex count, so I did a quick test and exported a cube from my favorite package using collada.

Every edge is hard and every UV is split, so the final vertex count should be 6 faces * 4 vertex > 24 vertex and 6 faces * 2 triangles > 12 triangles. In the editor (publishing on iPhone seemed consistent by I didn't checked every time) the cube indeed show up as using 24 vertex (and this seems logically unrelated to the number of data stored per vertex, second uv sets, normals etc) but the triangle count is up to 32!

Where the hell does those 20 extra triangles come from? Even considering extra invisible triangles are generated by the stripper for better performance this number is HUGE. There is more extra triangles than uv shells, or even original triangles so there's no way those are used only to connect shells together. Even to the extreme case where every single triangle in the mesh is not connected to any of its neighbor and requires an extra triangle each time we're still not up to 32.

Could this be some sort of stripping error or related to maya/collada? or have I skipped some sort of mesh compression option somewhere? Could there be a mistake in the way the strips are generated in unity or something like that?

Thanks for your time :)

EDIT:

It seems this bug only occurs in unity iPhone 1.5.1f2, I installed Unity 2.6 on the same machine and suddenly the triangle count shows up properly in the editor (it matches my 3d ap). A similar problem as this one: answers.unity3d.com/questions/1949/combine-fixed-function-error.

Can we only pray for a quick merge with the 2.x editor?

feedback.unity3d.com/pages/15793-unity-iphone/suggestions/163944-editor-upgrade-to-2-5-unity-editor

======================================================

Hello everyone, thanks for your interest :)

I submitted a Collada file using the bug report, here's the reference: http://intra.unity3d.com/fogbugz/default.asp?309907_288d81br , but I can't see the linked file: just in case www.mentalwarp.com/~transfert/CUBE.dae

If this is some real rendering bug and not some polygon counter issue (seems like it because error is consistent between iphone and editor), it would be more than awesome to spit ~30% more triangle hehe.

@Jessy I'm glad to ear this is not a 3d package related issue, yay

Quick note if you're using Maya.

Make sure that you delete history on all meshes before you import. I've noticed that if a mesh has a lot of history attached, the mesh will be imported DOUBLE in Unity. The only exception is with skinning -- skinning should be fine. If you are doing a character model that is going to be skinned, make sure to delete history BEFORE skinning it. Not sure this is what's causing your issue, but I know it's bugged me quite a lot.

Edit->Delete by type->History

Hope this helps!

This isn't an import bug -- 32 polygons is probably correct for a cube unless the cube has been specifically designed to be made of one strip. Triangles need to be contiguous in both 3D and UV space to form a strip. Degenerate triangles (zero area) have to be made to form strips, which accounts for the additional triangles. More than one degenerate triangle is required to connect two separate triangles into a single strip. It is necessary to combine strips so that calls can be limited.

I copied the following from an email where ReJ discussed the issue with why two separate triangles have 7 faces. He explains it better than I can:

Given two separate triangles (1st with vertices 1,2,3 and 2nd with vertices 4,5,6) then strip would look like this: 1, 2, 3, 3, 3, 4, 4, 5, 6 (9 indices in total)

For tristrips Unity uses following formula to convert index count to face count: face_count = index_count - 2. Therefore 7 faces.

==Removed incorrect answer after the OP and rune made sense in the comments==

This looks like a bug, if you could be so kind to send us the maya file in question (unitymenu->help->report a bug), we can take a look at what's acting up here.