Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

65535 vertices limit

Discussion in 'Editor & General Support' started by boolfone, Jan 30, 2015.

  1. wtelford

    wtelford

    Joined:
    Nov 13, 2013
    Posts:
    1
    I understand the limit, but the splitting behavior appears to be breaking blendshapes on the mesh. Any word on how to resolve that? Accommodating that upstream in the modeling and rigging pipeline doesn't make for a very flexible or agnostic pipeline. If Unity is taking the step to split a mesh it feels that unity should make sure to preserve blendshapes post split.
     
  2. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    I didn't read all the replies in this thread but the one that solves the problem being discussed here is to spend $100 or so on the DAZ Decimator and decimate to 50% or 25%. $100 is not a huge expense when you consider if you are using DAZ models then you should have already paid a $500 licensing fee. The alternative is to buy Poser Pro 11 Game Dev for about $500 too. Both DAZ and Poser go on sale periodically every year.

    If you are a good enough modeler you can import, decimate, and export via Blender too if you don't have $500 you want to spend on game developer licenses.
     
  3. delinx32

    delinx32

    Joined:
    Apr 20, 2012
    Posts:
    417
    I didn't read the whole thread either, but Unity states that its to improve memory utilization. That's admirable, but couldn't you give us a BigMesh class or something that allows us to have more verts when we need them and keep the memory performance when we don't?

    Also if you do, please let us pass more uvs to shaders.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,498
    Speaking of which, IIRC ability to have more than 65535 vertices in a mesh was available in either DirectX 8 or in DirectX 8.1. So, yeah, it is something unity guys would want to fix.
     
  5. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
    The current (16bit) limitation definitely interrupts the workflow when working with large meshes and feels something that should have been fixed a long time ago.
    I guess this is a typical '640K Ought to be Enough for Anyone' issue.
     
  6. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Ok, while I totally get that it's cumbersome when you're dealing with procedural meshes etc.... but for most of regular imported meshes, we just split the .FBX files up into chunks of 65k vertices. There it just results in more mesh renderer objects being created at import time, but generally should work. Or is that a big problem too?
     
  7. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,742
    Do you? Last time I looked you split meshes with less than 65535 vertices into multiple meshes based on some other odd metric, and when those meshes are combined they still have less than 65535 vertices and render with no problems, has this been fixed in 5.3?
     
  8. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Do you have details on what/how was happening?
     
  9. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,610
    Unfortunately DirectX isn't available on all 20+ of the platforms Unity supports. I think it's a lowest-common-denominator thing to help keep the engine as seamlessly cross-platform as possible.
     
  10. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,742
  11. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Unfortunately forum posts are terrible for keeping track of issues. Can you file a bug with that exact attachment and information? I'm jumping between 200 things each day, so I will forget about this thing in 3... 2...
     
    Kiwasi likes this.
  12. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Wow that's just like my brain at any given moment! Forgetting things of variable importance on the fly.
     
    daterre likes this.
  13. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    I agree. The mesh splitting is fine, it just needs to be done on meshes regardless if the data is coming from import or script in order to be a complete solution. I personally don't care how it's handled on the back-end.
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Probably has more than 33,000 verts, if counting all kinds of vert attributes...
     
  15. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You will always have to let unity split it. There is no way around this for Unity 5, nor will there be for Unity 5.
     
    ksam2 likes this.
  16. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    You can always split it manually yourself. That gives you as a dev full control of where the split happens.
     
    BrandyStarbrite and ksam2 like this.
  17. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    I'm having problems with this limitation as well. I'm trying to do some experiments for research, and at this point have to do a lot of custom batching, which inhibits my desired workflow.

    65k limit most likely won't be needed for any normal game, but it would be extremely nice to have a good workaround or 32bit option for those who are doing different things (rendering, research, cinematics / etc).
     
  18. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Bumped into it myself now.. sucks for canvas ui... having a large amount of text in a text component, and its doubled with any shadow effect, so can't have that on.. even though you only see a part of the text at any one time because its using a scrollarea and mask. Shame the mask implementation doesn't reduce the vertices of characters not displayed.

    And just how to check what the current vertex count is on a canvas.. so far I've found nothing exposed to check it.
     
  19. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Sorry to resurrect this thread. It would be great to have a checkbox in the settings to allow a larger amount of vertices / mesh (without splitting). I believe the Unreal engine used to have a 65k limitation, but not anymore.
     
  20. the_greenlig

    the_greenlig

    Joined:
    Feb 5, 2013
    Posts:
    29
    Joint bumping. This is a very frustrating issue if you are using source data that HAS to be larger than the 65k limit, and NEEDS to be one model. If you get a realistic scan of anatomy, for example, and you want users of your app to be able to manipulate sub-objects, mesh splitting brings in heaps of problems. Workarounds and optimisation further up the pipe are not an option when you are creating generic tools, especially around visualisation.

    This is a very frustrating problem, and the majority of answers here boil down to 1) More tris don't make a better artist 2) Decimate meshes, and 3) You don't need this. All of those are completely useless to anyone who KNOWS the limit and NEEDS it changed. Either an option for developers, or check if the buffer is larger than 65k, change it to 32 bit.

    How does threeJS handle it?
    Code (JavaScript):
    1. geometry.setIndex(new(geometryBuffer.indices.length > 65535 ?
    2.                 THREE.Uint32BufferAttribute : THREE.Uint16BufferAttribute)
    3.               (geometryBuffer.indices, 1));
    Answers that don't actually address the heart of the question are useless for users who know what they are trying to do.
     
    Ogdy and NEOMORPH_STUDIO_SRL like this.
  21. the_greenlig

    the_greenlig

    Joined:
    Feb 5, 2013
    Posts:
    29
    Re-bump, would love some official conversation around this :)
     
    Ogdy and Flurgle like this.
  22. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
  23. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,530
    AFAIK almost everything uses 32bit index buffers nowadays, so there's no much need for the limit any more.

    Maybe the limit could be lifted, but there could be a warning if you go over it? (like: you have a mesh that needs 32bit index buffers, that may be unsupported on some platforms, proceed at your own risk). Not sure if implementation is that easy though.
     
    the_greenlig, Todd-Wasson and Flurgle like this.
  24. the_greenlig

    the_greenlig

    Joined:
    Feb 5, 2013
    Posts:
    29
    It seems like a hard-coded limit that's years old, and they've painted themselves into a corner. 16bit index buffers would be an assumption for a lot of underlying tech I imagine. Please let me be wrong :)
     
    Flurgle likes this.
  25. MartinGram

    MartinGram

    Administrator

    Joined:
    Feb 24, 2017
    Posts:
    72
    @the_greenlig

    To answer your bump quickly, currently you will need to organise your meshes carefully before importing them into Unity, as it seems you are already doing.

    The 65k vertex/triangle limit is not being addressed at the moment, and incorporating different index buffer widths aren’t always trivial. There are hardware, memory, performance and usability limitations that all have to be considered. There are also different solutions available that would not require a change of index buffer width.

    This is an area that can cause confusion. So the topic has been noted down internally and we will address our options in due time.

    If you want to discuss this further we can obviously dig further into the technical details on how Unity and other engines solve the issue of large meshes.
     
  26. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @the_greenlig Unreal Engine 4 beta I believe removed all poly limits back in 2014, and Unity can and should do so as well. While scriptable render loop will solve a lot of the old problems, this limit will still make Unity seem like a 2nd rate graphics engine (A perception burned into the minds of countless people).
     
  27. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,843
    I do VR visualization for the AEC industries specifically for the original creator of the Revit CAD software. When an FBX is exported from one of these specialized CAD apps they are given a unique EntityID number stuck in square brackets at the end of it's name. To match the object with the Schedule which is that objects metadata, engineering data, delivery and install dates etc you need to poll for that ID amongst the imported game objects names. Companies like Trane will give architecture firms a smart model of their equipment as a real world example I ran into this week. So I have this 1x1x1 approximate cube of an air conditioner and on import the bloody thing had to be split into 5 pieces.There was some couch that was from some designer who thought that he was all that and a sandwich too and it had a 300,000 polys budget. OK..These companies are idiots for supplying the metal stampout 3D files to use in visualization software..but the issue comes when you try to parse the scene and extract EntityID's so you can tag the damned thing with scheduling data. Unity needs to come to grips with the fact that it's engine is not just a game engine where the paradigm is low poly, minimalist and hand holding the newbs so they don't abuse the software and crank it all up and then complain Unity sucks because they get lousy framerates on their laptops. For the architectural, automotive, engineering and construction fields, the mesh data will come from high end CAD workstations. Deal with it and stop making excuses. Give us a checkbox or method to import as a BigMesh class. I should not have to bill my clients more because I have to spend brainwork, analyzing data, create workarounds and test on multiple models because someone is stubborn at Unity about bringing the allowed vertices count to be up to date with modern hardware. Not only that but the Scene that contained the broken up the Trane air conditioner model as supplied by Trane to hundreds of thousand of architects kept hard crashing others Unity on attempted opening of the project.
     
    Tiles and Flurgle like this.
  28. the_greenlig

    the_greenlig

    Joined:
    Feb 5, 2013
    Posts:
    29
    Thanks for the response, Martin. I appreciate it might not be a trivial task to do, but it really is something that needs addressing. It's limiting our ability to work effectively with Unity, meaning Unity is becoming the non-preferred solution.

    Appreciate the response, would love to hear more about plans to address the problem.
     
  29. MartinGram

    MartinGram

    Administrator

    Joined:
    Feb 24, 2017
    Posts:
    72
    There has been movement on this topic. When we have a clear idea when and what, there will be a more news
     
  30. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Just adding a +1 to dealing with the 32bit index issue.

    I don't really have anything new to add to this thread as most of the great points have already been said. That said, my background is 3D scanning and VR visualization, so that should give some idea of why I want this as well.
     
  31. MartinGram

    MartinGram

    Administrator

    Joined:
    Feb 24, 2017
    Posts:
    72
    Good news everyone!

    There will be support for 32 bit Mesh indices coming in Unity 2017.3.

    Thanks to @Aras and his cohorts for making this happen and thanks to you all for your feedback and patience.
     
  32. fika_paus

    fika_paus

    Joined:
    Jul 22, 2016
    Posts:
    5
    Looking forward to it!

    Many thanks
     
  33. the_greenlig

    the_greenlig

    Joined:
    Feb 5, 2013
    Posts:
    29
    八(^□^*)
     
  34. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,244


    Yesss, really needed this to create a procedural mesh generated from point cloud data. Currently it's a mess to have multiple vertex/indice/color buffers split on multiple meshes.
     
  35. Ogdy

    Ogdy

    Joined:
    Dec 26, 2014
    Posts:
    21
    I've been working with dictionnaries and other hacky stuff to deal with the indexing of some big procedural meshes for almost a year...

    To all the people in this thread and Aras : I love you all :D
     
  36. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Amazing! This will usher in a new age of insanely cool assets
     
  37. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    For some reason even though Unity 2017.3 added support for 32 bit index buffers, I still get splitting when importing models. I get this error message:
    "Mesh 'Basket' was larger than 65k vertices but uses 16 bit index format. Split into 2 parts: 'Basket_MeshPart0', 'Basket_MeshPart1'."

    The file is a FBX, how do you 'make' it use 32 bit index format?
     
  38. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Model settings
     
    ceebeee likes this.
  39. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    ceebeee likes this.
  40. Green-VR

    Green-VR

    Joined:
    Apr 15, 2013
    Posts:
    12
    Looks like the main problem I'm having is that you can't import Blend shapes if unity has to split the model.
     
  41. Blepius

    Blepius

    Joined:
    Mar 9, 2021
    Posts:
    68
    Just a warning here for future travelers: although models over 65k verts seem to work now, they are definitely not a good idea to casually throw into your project due to the model importer.

    A single model over that's over 100k verts can easily take over 20 minutes to import if the importer starts ~~calculating normals~~ generating lightmap UVs-- and with how the import process can sometimes randomly trigger, this isn't going to be a one time process. It makes the idea prohibitive, I think.

    (Please correct me if I'm wrong, though, since huge models seem to be the solution for mesh terrain ideas.)

    edit: I was corrected!
     
    Last edited: Feb 5, 2022
  42. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,530
    Are you sure it's the normals calculation that's the issue? In my experience, the big resource hog was the lightmap UV generation.
     
  43. Blepius

    Blepius

    Joined:
    Mar 9, 2021
    Posts:
    68
    I just tested this on a fairly large model, normal calculations were instant while the lightmap generation process took ... it's still going, over 7 minutes now, haha.

    This sounds like a process best left for Blender, anyway. Thank you for the correction!
     
    AcidArrow likes this.
  44. Deleted User

    Deleted User

    Guest

    Nice topic. I generated highpoly meshes and spent 3 hours to find the problem. In a case if you need to do it in code.

    Code (CSharp):
    1. Mesh mesh = new Mesh();
    2. mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
     
    AnimalMan likes this.
  45. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    I can confirm

    UnityEngine.Rendering.IndexFormat.UInt32;

    can outlay a mesh with vertices count 512 x 512

    While the same mesh tares apart when asked for this size 512x512 at UInt16 bit maximum 16 bit, the default mesh that can be generated is 256x256 without changing the mesh array uInt

    a mesh of this size can be cumbersome to render twice, once in editor and once in game view but may be useable in the built application
     
    Last edited: Aug 12, 2022
  46. RistoPaasivirta

    RistoPaasivirta

    Joined:
    Aug 25, 2017
    Posts:
    20
    Lightmap UV generation for high poly meshes are best done outside of Unity. You are able to alleviate this issue by splitting the model into multiple parts if possible. The UV unfolding which is the heavy operation are done for each model separately within the FBX and then the layout packing are done to the models as a whole and it takes a lot less time. I have managed to cut down lightmap UV generation from 30 minutes down to 5 minutes just by making sure that the model is split into multiple meshes before export, still you are much better off doing the lightmap UV layout inside Blender, Maya or Max.

    I have imported couple million polygon architecture models from Daz and important thing to do is to make sure that they are made into static meshes inside Daz before export (many Daz architecture models uses bones to control doors etc).

    Some models from Daz3D are just a no go even if you don't need lightmap UV mapping (like 3 million polygon hair models, or million polygon clothing pieces).
     
  47. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Recalculate bounds normals and tangents for any live mesh changes is extremely expensive on a mesh of huge magnitude. Anything that does an iteration for all pieces. So a custom solution is better. Update these lists only at relevant points. The short cut is only useful on instancing the mesh on start or awake.

    for my purposes I am modifying vertices at runtime, on the aforementioned 256x256 and larger in builds, which I can do absolutely fine no overhead due to method, without directional lightning I only light up the parts the camera is on via spot. And it seems to be okay. The default lighting solutions are quite heavy. Without calculating tangents normals directional lighting (coming from an angle) can cause noticeable issues similar to tare. But this is generally solved with spot. This is useful for my purposes. But may not be useful if you wanted some slick high quality material with normals. Luckily for me my vert changing super mesh is only really for background purposes and doesn’t yet require that level of detail.

    the 3D modelling software tends to generate the mesh in a spiral algorithm. That is to say create verts length, height and then the algorithm deducts one as it spirals in on itself. To save sorting mesh from 3D modelling subdivide algorithm it can be more useful for me to make the mesh from script. Also to detach it from an object using graphics render if the rotation and position is never changed.