Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Trees - separate or grouped for performance?

Discussion in 'Editor & General Support' started by Foxxis, Jul 18, 2006.

  1. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Apologies if this has been asked already (have searched without luck):

    I have a bunch of trees that will be placed (either automagically or manually) within the scenes. They are all low-poly meshes <30. I expect around 100 or so visible at any one time. They will all use the same texture.

    Is there a considerable difference in performance depending on how these trees are grouped? Would unity perform better if the trees were grouped as to make each group hold 3-400 polys, or is it fine to have a large number of separate meshes with few polys?

    Not sure if I'm making myself clear here. Basically: is there a large overhead when having many, small meshes compared to few moderately sized ones?

    TIA!
    Dan
     
  2. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    Depends on your release date ;-)

    For now:
    Yes, there is a significant overhead. The rule of thumb is that you always pay for 1000 triangles no matter how many you draw.

    So join away - group nearby trees until you you have 1000 polys in each.

    (somewhat) Near future:
    There is work going on to let Unity do this at runtime: basically, you have a bunch of trees and parent them to a GameObject with a custom script. Then they will all get rendered as one object.

    So if you can live with it, I would recommend going with seperate meshes.
     
  3. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    I have a script that does about this now. The only thing remaining, if I recall correctly, is for me to transform the normals into the new space of the combined mesh. Otherwise a recalculate normals call fixes that.

    So, in conclusion, the original poster could get a programmer to help with this right now. The new mesh interface allows it. Just nothing out of the box. (As you all probably know, I'm just being clear. :) )

    Cheers,
    -Jon
     
  4. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Thanks for the replies! Will go with separate meshes and automate joining if needed.

    ...or you could post your code. :p ;)

    Again, thanks everyone!
    Dan