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

Single or Multi-Meshed Models

Discussion in 'General Graphics' started by RoryNi, May 26, 2015.

  1. RoryNi

    RoryNi

    Joined:
    Nov 17, 2013
    Posts:
    2
    Hello,

    I am a beginner to Unity - so must ask this question (using Blender for the models).
    When developing the 3D models that I aim to put in my game, should they be single mesh or comprised of multiple objects?
    For example, developing a model of a castle, should that be made of one entire object (mesh), or be comprised of multiple objects (such as an object for each wall, an object for each tower etc.)?

    Is there any reason why using a single mesh would be more advantageous than multiple objects in one model, or vice versa?

    Thanks,
    roza330
     
  2. OlavoDias

    OlavoDias

    Joined:
    May 2, 2015
    Posts:
    13
    I'd say sometimes it's impossible to do everything into a single mesh. It gets hard to put textures later if you have big meshes.

    I usually create all my meshes and export individually to Unity, then in Unity I group everything underneath a game object.

    One example: I had a racing car draw in 3DS Max... for the front wing, rear wing, tires., I had all in separated meshes...
    It was useful when I needed to show a "broken" front wing, and I needed to do was to deactivate my normal front wing mesh and activate the broken front wing mesh.

    On your castle, you might want the doors to open.. it's kinda hard to do a door opening animation if you don't have the doors in a separated mesh... IMHO.
     
  3. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    My understanding is that for slight speed purposes you are better with a single object. It isn't a big deal depending on how often you do it(how many objects, etc...) but those child objects do end up in a tree of subobjects, etc... so it may have a slight effect on speed in theory as Unity traverses the tree of gameobjects. I haven't tested, and most likely in most situations this won't effect much if at all.

    Now, for batching purposes, you want to try to make things use the same material when you can. Unity can do static and dynamic batching on things that use the same material, which does have to be the same texture set as well. So if you have a castle and things all with the same texture, it could likely get drawn in a single draw call, regardless of whether it is in multiple objects or not.

    The one advantage to having things in multiple objects, is actually a requirement if you need it, that you can separately animate the pieces via Unity's animation system. If you have everything as a single object, Unity can't animate it except as a whole. The animation system can if you have skeletal or even vertex animation, but that is a separate thing of course.
     
    theANMATOR2b likes this.
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
  5. RoryNi

    RoryNi

    Joined:
    Nov 17, 2013
    Posts:
    2
    Thanks for the quick replies, guys! You've been a great help.

    For anyone else in the same situation, what I've gathered from these helpful people are:
    • Separate objects/meshes are advantageous for parts of a total object that need animating.
    • Having as few different meshes as possible, sharing materials, can benefit overall performance.
    • Less objects means that Unity does not have to waste time processing longer lists of objects to find what you are looking for.
    In my castle example, I would do the following: create a single mesh for the main body of the castle, but have its doors in a separate object so that I can easily animate them to open or close.
     
    dandymcgee likes this.
  6. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,050
    Yes, but depends on how large your castle is. Since Castles are usually pretty large, especially in comparison to doors then it is likely you'll want to split up the castle into chunks so that large areas which are currently not within the viewport can be culled.

    You see in truth there is no right answer to your original question, just a number of good generalizations that should be considered as you design/build your assets/levels. Its then the balancing of these generalized rules to obtain either best performance or visually quality that decides what 'weight' each rule carries in your design/layout choices.

    Ultimately in many cases the only way to know for sure is to profile. So in general building models from smaller distinct parts and then combining them either in Unity (static/dynamic batching) or in your modelling application gives you the most freedom to evaluate and experiential. While ensuring as few different materials is nearly always a win in terms of performance, though maybe to the determent of visual interest.
     
    theANMATOR2b likes this.