Search Unity

"Meshes may not have more than 65535 *VERTICES* at the moment"... or is it triangles?

Discussion in 'Editor & General Support' started by dvochin2, Feb 12, 2013.

  1. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi all, the import procedure from the Unity 4.0.1 stumps me...

    I have a skinned mesh of about 37K vertices, 74K tris or 37K polys.

    When I import this in Unity, it splits in in two saying it can't import anything over 64K *vertices*. I only have 37K!

    If I reduce my tri count to < 64K, then it will import in one mesh... but this error message really should say 64K triangles instead of vertices...

    I know of the 16-bit limitation on vertex indices, but I know there are 32-bit indices for triangles...

    I somehow remember importing these large meshes without splitting in Unity 3.4... Has anything changed?

    Dan
     
  2. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    Is this info from Unity or from your modelling package ?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The message is correct. Your mesh has more than 64K vertices, probably because of verts needing to be split because of normals/uvs. The vertex count in your 3D app is not accurate for what the mesh actually is when imported into Unity.

    --Eric
     
  4. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    @Eric5h5

    Thanks was going to get to that part eventually hehe.
     
  5. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi guys, thanks for taking the time.

    The counts given above came from 3dsMax 2013. I have tried all possible permutations of import settings to no avail... (e.g. not importing normals, no mesh optimization, no write access and so on)

    That particular skinned mesh does contain 3 materials tho... still it only begins importing once I reduce the TRI count under 64K.

    Researching this some more, thinking this might have to do with a limitation of skinned meshes, or possibly my materials or even smoothing groups, I tried creating a simple sphere in 3dsMax of 33,540 vertices, 67,080 triangles and Unity splits that in two too! I reduce the tri count under 64K and it imports as one...

    Edit: If this gives more info, Unity import windows states that my first split mesh (of simple sphere above) cut off at the first submesh at 65534 tris and 33674 verts... with the 2nd part at 1546 tris and 1556 verts... this is with default import settings with read/write enabled, optimize mesh, import normal, calculate tangets splits.... this mesh again is not skinned, has 1 material, 1 smoothing group and is just a homogenous sphere!

    At the very least there is a bug in the message... should say 64K triangles not verts... but hopefully we'll return to being able to import up to 64K verts??

    Try replicating this simple test and you'll see...

    Me thinks this this a Unity bug! :-(
     
    Last edited: Feb 12, 2013
  6. PaulR

    PaulR

    Joined:
    Nov 14, 2012
    Posts:
    43
    The limit comes from using a 16bit index buffer. So 64k verts is correct. Fro triangle lists, 3 indices == 3 verts == 1 triangle.

    The 67080 triangles are are talking about are not actual triangle, but indices, and for those indices you have 33540 unique vertices.
     
  7. Dan_Tsukasa

    Dan_Tsukasa

    Joined:
    Jan 26, 2013
    Posts:
    155
    Hi

    This sounds like an animated and rigged mesh, this probably won't fix your issue but could you possibly explain why you're using a 65k polygon character or object that animates, that polycount is crazy high, and of course above unity's limits it seems.

    A mesh shouldn't need to be this high, especially not for a character or anything similar, perhaps for a few buildings.
     
  8. Annihlator

    Annihlator

    Joined:
    Oct 15, 2012
    Posts:
    378
    It's more simple.
    Unity counts every triangle as a single vert, 3ds probably (i know this behaviour from cinema4d) shows quads also as a single vert in the statistics.
     
  9. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi PaulR, I think that formula (3 indices == 3 verts == 1 triangle) is incorrect on most meshes that don't have smoothing group changes and changes of materials everwhere, when Unity has to duplicate verts to render hard edges or material transitions. For most meshes vertices are shared by many triangles... hence the different vertex and tri count reported by 3dsMax *and* Unity... as my example importing a single sphere with 1 smoothing group and 1 material shows, 3dsMax reports 33,540 vertices, 67,080 triangles and Unity reports (on the first submesh) 65534 tris and 33674 verts... with a clear cut one tri away from 65535.

    If this hard limit is necessayr at the minimum the message should be changed to 'triangles' instead of 'vertices'... but I seem to remember being able to import 64K meshes a few months ago... (The skinned mesh is a DAZ character I want to animate! )

    For people who want to duplicate the test, create a simple sphere in Max with 130 segments, apply a mesh smooth on top and that will create a single mesh just over 64K vertices... try importing that in Unity and you'll see it split in two even though it has one material and one smoothing group. Try reducing sphere < 64K triangles and it will import as one.

    Thanks again for all the input... weird problem for sure! :)
     
    Last edited: Feb 12, 2013
  10. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi all, has anyone had the chance to duplicate this test with a 65K triangle sphere imported in Unity being split into two submeshes?

    Is this a Unity bug?

    Thanks!

    Dan,
     
  11. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi, I'm still facing this Unity limitation in my work with the latest Unity, can anyone confirm this problem and do the sphere test described above?

    Many thanks!
     
  12. larvantholos

    larvantholos

    Joined:
    Oct 29, 2009
    Posts:
    668
    Its not a bug. When unity triangulates your model, and calculates the smoothing you will get a different vert count than in your 3d app. A solution for this is to triangulate the model yourself, and tell unity not to calculate the smoothing itself. You should convert your skinned model from a poly model into a mesh first as well, as that it is triangulated correctly, then unity wont mess with it as much.
     
  13. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi larvantholos, thanks for taking the time.

    But in my test above of importing a 67,080 triangle and 33,540 vertices sphere from 3dsMax that has only one smoothing group and one material (and no skin modifier), should it not import as one smoothing area and in one mesh?

    I just don't understand Unity's message mentioning the 64K vertex limit that actually splits meshes over 64 triangles!

    I have tried all permutations of Unity import settings and anything over 64K triangles will split the mesh...

    Dan,
     
  14. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    Are you feeding your .max file directly to Unity, or are you exporting FBX from Max?

    If the latter, can you post a screenshot of your export settings?
     
  15. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi superpig, thanks for helping out...

    I'm exporting that sphere test using Max 2013/64 through FBX with my normal FBX export settings:
    - In geometry sub-options: all options off.
    - Animations, Cameras, Light all off,
    - Embed media: yes
    - Axis conversion: Yup
    - FBX file format: 2013 binary.

    Try exporting a simple 64K+ triangle sphere using these settings with the latest Unity and you should see it split even though it only has about 37K verts with only one smoothing group and one material.

    I really think this is a Unity bug... or at the very least the message needs changing to warn about 64K *triangles*...

    Dan,
     
  16. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    Again, this is NOT a Unity bug.
    Here is an explanation about why this is happening.
     
  17. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,767
    This has been covered in another thread at http://forum.unity3d.com/threads/65535-vertices-limit.294585/ where Unity say they don't know why it is splitting meshes that do not need splitting, someone from the graphics team was supposed to post but they never did, try it for yourself with the attached file. It contains an FBX that is a simple plane with 48481 vertices in Max, importing that into Unity results in the error message of 65535 vertices and a split mesh, mesh one has 33137 verts and 65534 tris, mesh 2 has 15926 verts and 31266 tris, so a total of 49063 Unity vertices, so why has it been split? No one at Unity seems to be able to explain why it is being split, it is easy enough to create the same mesh procedurally in Unity with the same number of vertices and tris and Unity has no problem rendering it so why is it split?
     

    Attached Files:

  18. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    So actually even Unity Project View displays it wrong, lol! Yes, what the mesh preview says it indeed wrong, and unity was right to split the vertices. Look at my attached screenshot, in the stats there's the amount of vertices that the model TRULY has: over 150k ;) Screenshot1.jpg

    That's the true count of vertices the GPU has to render in the end.
    TBH I'm myself confused now. Just because one mesh has the true vertex count of 50k, and the other 100k. That's what's confusing me actually ...
    Again I refer to the video I linked. Worth to watch.

    EDIT: Looked at the meshes and the preview again: Max Tri count is always 65534. But the preview is still wrong, max TRUE limit is either 198.3h Tris OR 104.5k Verts. Don't know exactly.

    But you're right, something confusing is going on. atleast the error message was updated:

    "Meshes may not have more than 65534 vertices or triangles at the moment. Mesh 'Plane' will be split into n parts: 'Plane_MeshPart0', 'Plane_MeshPart1', ... 'Plane_MeshPartn'."
     
    Last edited: May 30, 2015
  19. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,767
    I don't think you are right there, the fbx mesh has 48481 vertices in it, there are no smoothing groups, no uv seams, no color seams it is just a simple plane mesh, when the fbx is imported you can see the 'actual' vertex counts when you click the mesh objects in the inspector. The GPU count is the count the car dis rendering but if you look it has done 9 batches for 2 mesh objects, Unity themselves say not to take the counts in the stats window to be accurate as it takes in account prepasses in shaders, shadow passes etc etc. If you point was correct then it would raise an even more serious issue in why Unity turns a single flat plane mesh with no smoothing groups, uv seams into a mesh with 3 times more vertices than it should be. If you read the other thread you will see even Aras does not understand why the mesh is being split, and other developers at Unity have looked at the issue and have said there is some issue as for some reason that no one at Unity seems to understand they split meshes on vertex count AND for some crazy reason on tri counts.
     
  20. Seneral

    Seneral

    Joined:
    Jun 2, 2014
    Posts:
    1,206
    Yep you seem to be right;) But atleast they updated the error message now...