Search Unity

Combining animated elements into one object to reduce drawcalls

Discussion in 'General Graphics' started by Hypnotoad0, Jan 29, 2015.

  1. Hypnotoad0

    Hypnotoad0

    Joined:
    Jun 22, 2013
    Posts:
    47
    So ive got this generic animated dude I put together in 3ds max in about 10 minutes.



    This is a mobile project so Im trying to reduce drawcalls/optimize everything i possibly can. Every part of his body is a separate object so it wastes one drawcall per light when its lit (and there are 11 elements). Im planning to have an average of 5-6 lights active at the same time and combining the characters elements into one would reduce drawcalls by about 10 or more.

    The thing is im not sure how to achieve that (or if its possible).
     
  2. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    you could have a texture atlas (all pieces share a material/texture), and make sure its low poly enough to qualify for batching?
    http://docs.unity3d.com/Manual/DrawCallBatching.html

    hmm in blender id use bones to animate him, and itd be all 1 mesh... but bones can be costly, but, not too costly, that would have maybe 8 bones? maybe 10? or 11? depending how movable youd want him to be...

    or maybe in blender i could use shape keys.. then it doesnt have bones... havent used shapekeys really myself yet though, dunno how optimal it is, or if its more optimal than bones.... id assume it IS more optimal than bones (just a total guess) but yeah i dunno

    i have very little interest in mobile dev so i dunno about its specific optimizations
     
  3. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Pretty much same suggestion here though I use Max for 3D character development. Use a basic bone setup to animate the character. Bones aren't costly now - they are the standard way to animate characters. And the original suggested bone count for characters in the Unity manual is very low for current standards.

    How are you accomplishing the animation now?

    For shape keys (known as morphs in Max) this isn't a good idea to animate complete characters unless it's super simple morph animations like bend left - bend right - bounce.

    Combine the character into one complete mesh and combine the textures/materials into one UV. This will save you at least 10 draw call per light.
    Based on the simplicity of the character - if you want each mesh element to keep it's boxy shape without organic deformation (bending), when you weight the verts to the bones - weight one box mesh element to each bone without any blending from other bones. This will keep the box shapes solid looking.

    There is a rigid skin weighting in the skin modifier but I haven't noticed any difference once the character is brought into Unity.