Search code examples
optimizationunity-game-enginemesh3dsmax

In Unity Combine Meshes Vs Instance Objects the Difference


I am in a serious need of optimization of my some Unity projects and i have so many objects which are from 3DsMax, so i am wondering if Combining the meshes would have any effect on the memory/performance or i should leave the objects Instance to each other as it would save me some space.

This arise the question that what is the difference between Combined mesh objects or Instance Objects as it will save a lot of memory and hassle if one realy knows the difference and what is better

Looking forward for some Brief information about the two

Thanks


Solution

  • Combining is useful if you have a lot of unique assets that only appear once or twice in a scene, e.g unique buildings in a 3D FPS, but not cloned houses in a SimCity style game. If you have a model that appears many times in a scene it's more performant to have Unity (automatically) batch them, this is Unity's default behaviour. e.g lets say your scene is in an art gallery; if the gallery contains a dozen distinct sculptures then combine them. If it contains a dozen of the same sculpture don't bother, Unity will batch them for you.

    However, you should be wary of using different materials, each material adds to the draw count. So, if you had 10 of the same model but using 5 different materials it's going to be expensive. The way round this is to use a texture atlas with a single material, with different UV mapping for each models. This means you have a lot of different models, but save on render time due to the single material.

    Also, be aware that transparent shaders much more expensive than opaque, if you have three semi transparent objects in front of each other that's at least 4 render passes.

    As you probably know this is a complex subject with a lot of variables (many more than I can describe here) and is best judged by using the profiler.

    Here are some general rules of thumb I've learned while creating a game for mobile which naturally is performance critical:

    • Use as few a materials as possible
    • Use as fewer textures as possible, share textures between materials
    • Recycle models as often as possible. Often a model oriented at a different angle or in a different material can look like a whole new model to the player, particularly if their attention is elsewhere in the game
    • Use LODS extensively
    • Ensure your models are clean, remove all unnecessary vertices before importing
    • After importing think if there's anything about the model that could be represented with less vertices
    • Good use of normal mapping can pay off, depending on the platform. If you can trade in 1000 verts for a 256 px normal map and 50 verts then do it, otherwise dont bother normal mapping just to save a few verts