Search Unity

[SOLVED] Vertices increase on import

Discussion in 'Editor & General Support' started by Jojoba007, Oct 21, 2018.

  1. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    Hi, I'm trying to understand the following:

    For example I have a 3d model that has 142 vertices in my 3d modeling package. Once I import this model into Unity this same model has suddenly 10 or 20 times the amount of vertices. I know this has something to do with the color, UV's, Smoothing etc.
    How would I correctly reduce the amount of vertices for those models? How can I make sure that if I import that specific model the vertices won't be 10 times the amount of vertices. My model only uses a simple texture without any bump maps or anything special. What is the workflow for this? I'm trying to understand why the vertices gets 10x increased?

    Anyone got a good explanation for this? And why is this happening exactly? Is there maybe a tutorial or something for this on how to handle this?

    As you can see here in Unity my simple character has lots of vertices: See screenhot: http://prntscr.com/l8lgkj
    But in my modeling program only 142: See screenhot: http://prntscr.com/l8li0c

    Regards
     
    Last edited: Oct 21, 2018
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    That value includes the skybox. Change the camera to use a color instead of skybox. You can also see the value by expanding the imported model in the project view and selecting it's mesh object.
     
  3. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    @karl_jones Thanks for the reply. After removing the skybox, which resulted in the scene to only have 3 vertices, I added the model to the scene and now it gives me 1.3k vertices. See screenshot: http://prntscr.com/l8w4ho
    This is still an increase 10 fold of the vertex amount that the modeling package showed me. Is this correct? Is there maybe a resource where this is explained?

    So let's say if i build a mobile game and the max amount of vertices for a mobile model is recommended to be around 25,000 vertices, so when modeling inside the 3d package i must calculate the total vertices 10x to come up with the correct vertex amount in Unity? So once I have a model of 2500 vertices inside the modeling package this will result in a model with 25,000 vertices in Unity?
     
    Last edited: Oct 22, 2018
  4. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    1.Unity will triangulate the model.
    2.Unity does add new vertices to make hard corners in the mesh.

    But this should not result in a 10x increase in vertices.
     
    bygish69 and Jojoba007 like this.
  5. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    Then I'm wondering what causes this? It's just a simple FBX export from Max to Unity. The model only has a simple material aplied to it. I'm not sure why this happens. Anyone else?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Did you inspect the imported mesh to see what the vertex values are? Use that instead of the scene. The scene value may also be including other things such as shadows.
     
    Peter77 likes this.
  7. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    If you have more than one material:
    increase vertex count by material count

    If you have a UVMap:
    Increase vertex count by magnitude of 1 x number of materials with a UV map

    if you have multiple textures on your UV map
    Increase vertex count by magnitude of 1 x number of materials x number of materials

    if you are not using smooth shading
    Increase vertex count by magnitude of 1

    There are dozens of other multipliers as well. Basically, nothing is free.
     
  8. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    @karl_jones As you can see here the vertices are 1272 in Unity and in Max it is 344 (I had ignore backfacing on ;-) : http://prntscr.com/l9czn0. So that reduces 10 fold to 3 fold the amount of vertices. It's better already ;-)

    @Ne0mega Thanks for the explanation. I use 1 simple diffuse texture, 1 UV map and hard corners for the model. So does this explain the increase from 344 to 1272 vertices for that specific model?

    And is there maybe a workflow explained somewhere with the above in mind how to be spare with model export etc so the model will be optimized for export?
     
    Last edited: Oct 23, 2018
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Are you sure that max is not generating these when you export?

    https://forum.unity.com/threads/vertex-and-poly-count-increases-in-unity.53612/
     
  10. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    @karl_jones Thanks for bringing that topic up. As suggested in the topic I tried the "Turn to Poly" modifier in max but my polygons are already maximum optimized so the result is the same for triangles.
    I think the increase of vertices has to do with the hard edged the model has. It doesn't have a smoothing group. So for the hard edges Unity adds additional vertices necessary to render the edges. That's also the conclusion in that specific topic.
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Yes that is expected. It still seems like quite a lot for you though. Your mesh has a lot of triangles that could be optimised to reduce it. You don't need all those quads.
     
    Last edited: Oct 23, 2018
  12. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    @karl_jones I agree, it doesn’t need all the quads. The reason is that the model is exported from voxel editor Qubicle to Max to Unity. I now optimized the mesh in Max and brought down vertices to 124 in Max. But again, from Max to Unity the model increases to 534 vertices. I can no other conclude it has to do with the hard edges. It’s ok for now till maybe someone comes up with another explanation ;-). Thanks so far.
     
    karl_jones likes this.
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Try disabling the import normals and tangents options. The values should match then. https://docs.unity3d.com/Manual/FBXImporter-Model.html
     
    wang37921 likes this.
  14. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    @karl_jones Thanks for the reply. I disabled normals and tangents on the model, but the vertices stay the same. Still an increase of 400%. 124 in Max and 534 in Unity.
     
  15. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    It sounds like maybe max is generating the extra verts when you export. Can you share the fbx?
     
    Jojoba007 likes this.
  16. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    Hi @karl_jones I have send you the FBX file through a private conversation.
     
  17. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
  18. Jojoba007

    Jojoba007

    Joined:
    Feb 11, 2017
    Posts:
    148
    karl_jones likes this.
  19. Supernectar

    Supernectar

    Joined:
    Apr 28, 2020
    Posts:
    1
    I think it is important to note that a light source, such as the directional light displayed in the default scene for example, will also add verts if set to generate shadows
     
    alemnunez and MieluShaun like this.
  20. sepidehamirdady

    sepidehamirdady

    Joined:
    Mar 1, 2024
    Posts:
    2
    What I usually do is to use framedebugger to see what the source of problem is, sometimes it is lights, sometimes it is additional unwanted shader, another time I found out it is transparency even, this link is a great.