Search Unity

Which is the best/most efficient method of rigging in 3DS Max to use in Unity?

Discussion in 'Animation' started by GKdev1980, Feb 20, 2015.

  1. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    Ok, here's the thing.. I've had a few experience in 3DS Max and Unity. Not too advanced stuff, but enough to make myself a complete 3D mini-game. I needed character animation inside my game, so I looked for tutorials on rigging in 3DS Max, and learned some basic stuff about biped rigging. Seemed quite nice and easy enough for some basic use.

    I'm thinking of taking things to the next level though, so I'm looking for the best method I should research and become experienced enough to get the most out of the models I'm working with. For example I would like to add facial rigging with facial expressions (lip syncing would be REALLY cool) or add clothes (maybe even swap clothing in-game), edit my model and partially re-use my previous rigging and more...

    For the sake of argument, let's assume we're talking about humanoid characters, as I see it that would cover 90% or more of workload. As I've said, I've already use biped rigging, seemed REALLY convenient to use (or edit and use) .bip animations out-of-the-box. I believe I've encountered some other type of animation files, .bvh, but I'm not sure if they were meant to be used in biped rigs, CAT rigs or something else..

    So to sum up, I've seen: - Biped rigging - CAT rigging - Generic bone rigging - Some other kind of rigging I've seen in tutorials with some circles and arrows and stuff, not completely sure what they are about to be honest.

    Which on of them (or other) would be the most suitable for me to research and master to use inside Unity?
     
    Burkard likes this.
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Hey there @abracadabra1980
    Please click on my name and research any 3D Max animation and rigging related content.

    The circles you speak of is a custom character setup in Max. I have very little experience using these optional tools but they help when you have a custom 'bone' setup which gives you pose tools similar to the pose tools found under the motion panel when using biped.

    I've commented previously on how to get the best workflow using biped so I won't repeat here.

    Taking things to the next level requires a lot of prototyping and workflow setup for yourself to get confident in the process you use. It takes time to get comfortable with a good workflow for clothing and facial rigs.
    One other option you didn't mention was morphs. But the best practice I've read about is if you have several characters to apply facial expressions to - the best setup is to use bones and dummies for rigging/skinning and use the same rig for multiple characters. This is also explained in several places so I'll leave you to perform the proper research and experiment.

    CAT has some 'issues' with it which I find unappealing compared to Biped when the final output is going into Unity, with that said I know several animators who love using CAT.
    Custom bone rigs are the best in my opinion because of there versatility and awesome animation controllers, but biped has some very nice advanced features which allow for speedy rigging and pose to pose animations - which can be used as base keys then converted to linear animation after you are happy with the results.
    Also I have never ran into a custom character/creature which I haven't been able to pose the base biped into. Some creatures may need additional legs if more than 4 but using biped still gives you the advanced animation tools not available with a complete bone animation rig.
    Example Dragon rig with biped, minus extra bones for wings.
    BaseBiped_FIGFile.jpg

    Personal note - stay away from the prop options under biped. It's better just to use a link controller and a non renderable box that can control any props/weapons far better than the built in prop options.

    Know what you are getting with biped before you begin, the outdated animation controller that the BIP and IK constrained bones use is very complicated to tweak when you need complete animation curve access, but this can also be overcome if you are aware of workarounds like setting a separate root bone the bip is parented to before starting to lay down set keys on the arms and legs.

    Biped is also very versatile when using it to combine mocap (bvh) and custom animation motion files. animation layers and motion mixer allows you to use most any type of animation file on a biped and bake down into one file or blend/tweak separate animations files until you are satisfied.

    Hope this helped out a little bit. There is a lot more Max to Unity related content in other posts I've made.

    Good luck - happy animating!
     
    huyakinemota_unity and GKdev1980 like this.
  3. Jself

    Jself

    Joined:
    May 29, 2014
    Posts:
    56
    Biped is nice and all. But I would recommend not using if if you plan on using Unity's Humanoid standard.

    I am curious as to why CAT would be avoidable though.
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I've had no problem fitting biped to the humanoid rig. Once you have a good rig, matched to the humanoid structure - biped imports seamlessly.

    I didn't say CAT should be avoided. For me personally - CAT has several little issues that are just simpler to do when using biped, primarily the pose tools in biped.

    Not taking anything away from the CAT system, I enjoy using it.
    CAT's base rig setup and base rigs are superior to biped in almost every way. The initial rig setup is faster in CAT because each limb hierarchy is independent and can be edited very easily compared to some small limitations with the biped base rig.

    The cat motion layer weights based on local limbs is nice if you like to manage weighting but I've never understood the benefit of managing layer weights over just direct limb animations on a set timeline. Seems like just an additional step to me. I guess one advantage is maybe setting two animations for the same limb and animating them independently then blending between the two, but - no actually that doesn't really seem beneficial.
    Using the layers as a nondestructive workflow for animation creation is an option but not the only one.
    The adjustment layers are a nice feature that is also available for biped since version 6? when the motion mixer was first introduced.

    For non real-time cycle animations the layer weights are nice for blending between walk - run - skip - hop into dive, but with real-time animation cycles used for our games, this blending isn't really needed for animation development. The blending is controlled in Unity.
    One benefit I can see - (never used in this manner) is if you wanted to alter a walk cycle to be an uphill or down hill climbing walk. Layers could be helpful, though it would be just as easy to copy the walk cycle keys and alter them to be an uphill walk cycle.

    One overlooked tool in biped is the pose tool which is very helpful for creating animation cycles. When I use biped I use it a lot. It's easy to use and doesn't inhibit the animator from creating the performance needed. It just helps the animator get more work done in a shorter amount of time.
    One aspect of the pose tool which is very helpful is creating mirrored animations for non-bipedal characters.
     
    GKdev1980 likes this.
  5. mikesawicki64

    mikesawicki64

    Joined:
    May 12, 2014
    Posts:
    33
    I'm a big fan of good ol' bone tools. Never let me down
     
    GKdev1980 and theANMATOR2b like this.
  6. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    @theANMATOR2b
    I went through your posts, or at least most of them I guess, I've noted down a couple of advices regarding exporting from 3DS Max to Unity, one being
    "Uncheck triangle pelvis and check triangle neck under biped structure."


    and another being:
    "a base rig imported into Unity without animation, one large fbx for animating (copy/paste poses and other beneficial workflows for having all the animations in one file), and one .max/fbx file per animation for importing into Unity"


    Don't know if I'm missing anything else..

    @mikeDigs
    I suppose custom bone setup is the way to go when you need the most control out of your rig, the reason I prefer going with a Biped or CAT rig is purely because I'm not an experienced animator, so the idea of having to make every single animation from scratch kind of frightens me. So, at least at this point, I find very convenient to start sometimes with a .bip or .bvh file and edit it to match my specific needs.


    @Jself
    I started using Biped simply because it was the first one I came up with during my initial research, followed some tutorials and seemed less intimidating. I tried switching to CAT in my previous (and first complete game) app after having rigged with biped, I thought it would be easier, for some reason I cannot recall (it's been a few months) I had trouble either with rigging or exporting that made me give up..



    To be more specific and refer to the specific project I'm working on right now, I have a model that consists of several separate meshes(head, eyes, nose, ears, tongue/teeth, clothes, legs, shoes, hands are all different objects). From what I've seen (and learned the hard way) it's best to work with as few objects as possible, especially when you intend to make a mobile app like me, since the draw calls are raising exponentially inside Unity, rendering the game unplayable. So normally I would attach all the objects to a single Editable Poly, make my animations there and export to .fbx. That's what I did in my first game
    (you can check it out here by the way:
    https://play.google.com/store/apps/details?id=com.zennogames.drunkted3d)


    Now I want to do a few more things though. I want to move the eyes independently from the rest of the model, open/close mouth and maybe change clothes in-game. I will also need to edit my model to correspond to different ages. These things raise some issues that would be nice if I knew the right way before I start rigging like I did before, leaving me with the option to simply add on the work that I've already done and not having to delete my work and start over.

    So:
    1. Eyes
    From the little I know, seems like quite an easy task, they will have to be a separate object, add a couple of custom bones and link them to the head bone. Right?


    2. Mouth
    That looks a bit tricky, I would probably have to add a morph modifier to the face mesh and add some controls. I have no idea how to do it, I've downloaded some tutorials to look into, I'm not sure if the teeth/tongue should be a separate object or not.


    3. Clothes
    That I find a bit hard. First of all because in my model there's nothing below the clothes the model originally wore (it's not like I could hide the clothes and see my model naked), there's no geometry there so to start with, I would have to guess some anatomy and redesign the whole body, since not all clothes would cover the same area of the body. Apart from that, I've read that I can share rigging and skinning between different models. If this is the case, I could model e.g. a different set of pants and copy/paste the rigging from the original model. Is this true? Or would I have to make a new rig every single time? And does it make sense to model a naked model and separate objects for the clothes? Or different files consisting of the body along with the clothes and use them as a single object each time?

    4. Different ages (similar models with minor editing)
    In this case, would I have to rig the whole thing every time all over again? Or for example if I scale the forearms in my model it's easy to use the previous rig and just scale the forearm bones, maybe edit those specific envelopes a bit and the rest would work just fine?


    At this point, I've attached ALL of my objects to a single Editable Poly and started rigging. Does this make any sense to do that and later on for example delete the eyes elements and rig them separately, doing the same for the rest of the stuff I have in mind? Or am I going completely the wrong way here?
     
    huyakinemota_unity likes this.
  7. Jself

    Jself

    Joined:
    May 29, 2014
    Posts:
    56
    My method has to be add all the mesh pieces that will fit one skeleton and skin them all together. Then export them out individually or how ever. I do this to make sure that no mesh clip through each other since the skin is consistent.

    If I am using Biped. I will create bone objects to control eyes and other assets like a dress or cape. My experience with using Biped extras has never gone smoothly. If I was using CAT or puppetshop I would use their own "Extra" bones instead.

    I personally stay away from Morph targets for facials. I just create a bone setup for facial animations and animate that way.

    If the height of the character changes, i would redo this process with a new skeleton for that particular height.

    Also. I have nothing against Biped. I have used it professionally for the last 10 years. It's just that there are some details you have to be aware of when using it for Unity that is not setup correctly by default in Biped. I personally enjoy Character Studio or Puppetshop.
     
    theANMATOR2b and GKdev1980 like this.
  8. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    Hmm.. How do you mean "add all the mesh pieces that will fit one skeleton and skin them all together"?

    By adding you mean attaching them to a single editable poly? Or selecting them all together and basically adding a skin modifier to every single editable poly individually? In the second case exporting them to an .fbx file would result (correct me if I'm wrong) to multiple draw calls in Unity even for having my model standing in my scene... That would kill my mobile app.

    And another thing. I remember in one of the first tutorials I had followed about rigging/skinning the tutor said that after the skin modifier is applied, if you remove any vertices the remaining vertices are re-numbered and that could cause serious issues. But according to another tutorial I saw yesterday, I can remove edges along with the vertices, and the rest of the rigging is not affected at all. Here is the link to the second tutorial, look in 1:16:20:

    Is one of them wrong? Or does it have to do with different versions of 3DS Max?
     
  9. Jself

    Jself

    Joined:
    May 29, 2014
    Posts:
    56
    Oh. I meant that you can have all your meshes Dresses, shirts, gloves, boots and body all in one max file. Select all of them, then add the skin modifier. So they all share the same instance of the Skin modifier and you can skin it based off of that. You can hide certain meshes as you skin for a easy process. This is more of a quick pipeline method, not a optimization method in Unity.

    If you remove verts, it will change the vert count and may affect your skin data. Since it is relying on a particular vert being a certain number. It just depends though. Removing edges is different in my experience. Since I remove and turn edges after the modeler gives me the mesh for me to animate.

    Unity considers each separate mesh as a draw call. If your mesh is not welded together as one, it's not one draw call. Far as I know.
     
  10. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    Oh so that was an answer to my clothing issue. I see.

    Do you have anything specific against morph targets? I mean, did you face any issues working with them? Or is it just a matter of personal preference?
     
  11. Jself

    Jself

    Joined:
    May 29, 2014
    Posts:
    56
    Engines in the past never accepted morph targets, far as I know. If they did. It was expensive and was sacrificed for other things. I was surprised to see that Unity supports it.

    But I am curious as to how the draw call is for it though. Since FBX likes to export everything associated with the skin modifier, even if it isn't selected (Or that is how I see it). And each separate mesh is a draw call. So I would assume each mesh you have for a morph target, that is part of the skin, would be considered a draw call.

    I am not saying that is factual. Just something I am curious to research now.
     
    GKdev1980 likes this.
  12. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    One think implied I don't think I spelled out is the reason to get a rig setup as humanoid so it's seamless because once you start retargeting or applying a high number of animations - manually configuring the bone mapping and avatar for each animation is time consuming and repetitive. One benefit of bringing in one fbx file with all animations is this setup only needs to be performed once, but if you need to edit the length of any animation, the process will have to be re-done again, and all the animation segments will have to be redone - again. Compared to just having one animation that needs edited, fix it in max, re-export, re-import, retarget to existing character already in Unity.

    Interesting - I find the results from this process look incomplete and "canned". For me this process is actually more time consuming, because of the "canned" look I spend more time editing curves, re-adjusting keys to get a more customized and personal animation. There are a lot of games that use a modified version of the default CAT walk and a modified version of the default footsteps from biped. It shows in the quality - if the extra time isn't spent on making it unique.
    This is one area I like using CAT's animation layers.

    I like morphs, but if you have more than one character it's best to create a bone rig. Then the rig can be used for all the characters. I have only prototyped this in concept very limited so I haven't set up a personal best practice. But if you can get a good workflow for this all your characters can use the same bone rig and all the animations. And if you need custom animations for specific characters, just make them on the time line for that one character.
    The only thing negative about morph targets is they are linear but the morph controls in Max have become better to overcome this limitation. I believe there are some curve functions specific to the morph modifier which kind of fix this. Back in the day this had to be done manually so if you wanted the lips to curl down and around say some large bottom fangs you would have to create 1 additional morph and edit the animation curve to get the proper result.
    Another example is a realistic blink. The lid curves around the eye not linearly morphs from point A to point B. But there are some advanced curve tools with the morph modifier which I believe overcome this. I haven't used them in a little while so you'll have to experiment.

    Partially true. Actually back in the day the only type of animations you could do was vertex based animations (morphs). Bones wasn't even a concept. That's where all the standard modifiers in Max began, bend, twist, bevel, wave, ffd all were available before bones.
    I believe unreal's first engine didn't have bones. I may be mistaken but when XNA first came out it didn't even support bone based animation.
    But the last couple generations (3-4) engines have all supported bone based animations and morphs/blend shapes/blend keys are now available because the computers are faster, because morphs are more expensive than animating with a bone hierarchy.

    Another non factual comment from me, because I've only dabbled with the process, not the end results and optimizations.
    A morph is simply a vertex based animation once it is processed through fbx. It's not a separate mesh. The extra mesh pieces aren't brought into Unity. Unity just reads the x,y,z or every vertex. So I don't think this would add any draw calls but because it's vertex based there is a hit to performance. I don't know what it is or how it is handled by the computer gpu/cpu, but a good rule of thumb is to make the morphing mesh as light as possible. Instead of morphing a complete character just for facial animation, maybe you can only do the head, or the upper body.
    Different clothing load outs complicates this a lot - especially if you want the character to be able to be naked or nearly naked, with multiple character clothing sets, and morphs for facial animation, or maybe other applications for morph, like making them thicker, bulkier, thinner. Lots of variables and factors to consider. FUN!
     
    GKdev1980 likes this.
  13. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    I've decided to go with morphs for the face, and to keep the morph targets light I kept the head as a separate mesh.

    Which leads me to another issue, which is the optimum way to split my meshes, both in terms of performance and convenience.

    My original character model was split in many separate meshes:
    • Face
    • Eyes (2 meshes)
    • Nose
    • Tongue
    • Upper Jaw (inside of mouth)
    • Lower Jaw (inside of mouth)
    • Eyebrows
    • Shoes (2 meshes)
    • Legs
    • Ears
    • Hands
    • Clothes (as I mentioned there were no geometry below the clothes)
    Of course it makes no sense to keep all these meshes separate as that would result in a whole bunch of unnecessary draw calls for each frame. If I didn't intend to use multiple clothing sets I would attach the meshes to several larger sets:
    • Face
    • Nose
    • Tongue
    • Upper Jaw
    • Lower Jaw
    • Eyebrows
    for the head, as I would use it for the morphs, I would keep the eyes in separate meshes since I want to be able to control them separately as to where they are looking at, and the rest:
    • Legs
    • Hands
    • Clothes
    • Shoes
    in a separate mesh. That would result in a total of 4 total meshes for my character, with 4 draw calls..

    The fact that I need the character to switch clothes in-game complicates things a bit. First of all, I had to model the naked body (the part beneath the clothes and shoes) by myself. I did that by editing the clothes meshes and changing the texture.

    And now comes the part of attaching the meshes to the optimum number of total meshes.

    The way I see it, there are 3 ways to go:
    1. I make completely different models for each of my clothing set, eg one when he's naked, one when he's wearing clothing set #1, one when he's wearing clothing set #2 etc, and only one of them is visible on screen on any given time. This way I get to keep my draw calls number to 4 each time, but I have to switch from one model to another in-game..
    2. This is the way I originally decided to go with. I modeled the naked body, I made it smaller than the clothes so the clothes would be added OVER the existing body and add 3 draw calls each time (1 for the upper body clothing, 1 for the lower body clothing and 1 for the shoes) while adding a few thousand of triangles (judging from the initial clothing I expect around 15k tris more each time). I'm half way through in implementing this, I'm curious as to how the rigging of the clothes will follow through and that is some part of my movement part of the hands may be revealed unintentionally.
    3. I'm considering switching to this option instead of the second one to get rid of the extra 15k tris each time and not having to think about geometry overlapping. I'm thinking of even splitting the naked body to 5 parts:
    • Upper Body
    • Lower Body
    • Hands
    • Legs
    • Feet
    , and each time replacing each of these meshes to the parts of the clothing set. That is, removing (or disabling) the lower body and enabling a pair of short pants, disabling the upper body and enabling a T-Shirt, disabling feet and enabling shoes etc. This way I would save myself from a lot of extra triangles, but I'm worried about the edges where the naked body parts meet and how I would implement seamless rigging there. I would also have 8 draw calls each time, regardless of whether the model has clothes on or not.

    Any thoughts of advantages and disadvantages on each of the methods instead of the rest?
     
  14. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Separate mesh eyes are not needed to control where they look. You can attach (not weld) the eyes to the head mesh and rig 1 bone or dummy to control the eyes. Before attaching the eyes - align the dummy to the rotation axis (center) of the eyes so after attaching and skinning the eyes only - to the dummies, the dummies will have the exact same rotation axis the eyes had before attaching them to the head.

    Are you talking about a realistic character? Because the above quote is confusing. Unless you plan to swap these pieces as well I would make the entire head except 1 mesh. If you want additional control with the teeth and lower lip, you may consider keeping the lower teeth separate objects. But personally I don't see any benefit of keeping so many separate mesh objects.


    Look up occlusion map. I haven't performed this process in Unity myself but I've read about it and it seems like the most logical solution to the concern of overlapping geometry.
    Mixamo hints at this process in one of there tuts.
     
    GKdev1980 likes this.
  15. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    1. You're absolutely correct, I will look into the eyes thing, I will save myself 2 draw calls.

    2. Sorry, text formatting didn't help much, the list had to be read along with the next line, all those meshes would be attached to a single "head" mesh..

    3. I will look into the occlusion tutorials, thank you very much..


    In conclusion, which of the 3 ways I mentioned earlier do you think is the most sutable? Regarding both rigging and handling inside Unity..
     
  16. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    With the knowledge (no experience) of occlusion mapping, I think the best - most professional - approach is to do a character with several different clothing load outs - as a complete (naked) mesh - and create the clothing as separate mesh objects - to be swapped out on the model. Though the occlusion map would also have to be swapped when a different outfit was selected. This also simplifies rigging.

    Also - if your unfamiliar - I would suggest looking into and working through several 'skin wrap' tutorials/techniques in Max. Skin wrap is a nice modifier which reads the skinning data from a base character mesh (no additional rigging involved) and drives the cloth mesh from that data.
    After animations are complete, the skin wrap modifier can be converted to a regular skin modifier and exported. This separate mesh, and skin, and animations on the clothing are properly rigged to the base mesh characters animation bones. Very nice workflow process if you can get comfortable with it. Look into it.
     
    GKdev1980 likes this.
  17. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    Thank you, I will..
     
  18. Jself

    Jself

    Joined:
    May 29, 2014
    Posts:
    56
    This is the method I have used in almost all production pipelines (Separate mesh objects). Never have I had clothing lay on top of body meshes.

    Basically don't have polygons in a scene if you can't see them.
     
    theANMATOR2b likes this.
  19. GKdev1980

    GKdev1980

    Joined:
    Dec 10, 2013
    Posts:
    29
    That's what I think too.. The only question then is when I load the scene I have to import ALL of my clothing sets and just keep all that I don't need disabled (or disable the Renderer)? Wouldn't that increase the loading time? Or is there a more efficient way?
     
  20. Jself

    Jself

    Joined:
    May 29, 2014
    Posts:
    56
    I have no idea at that one. That could be a engineering question.

    Typically. We would export each piece independently and put what we needed together, at runtime with code.
     
    theANMATOR2b likes this.
  21. Max_Bol

    Max_Bol

    Joined:
    May 12, 2014
    Posts:
    168
    Well, for a quick yet efficient visual example, check this http://fileserv.polter.pl/1594-CDPRED_SIGGRAPH.pdf
    It's a documentation on how they though and made Witcher 1 and 2 characters as well as some explaination on how they allowed many customization in their RedEngine3.

    Note that, for the texture part, you will need a software like Substance Designer to build the substance files for adaptive CPU based textures.
     
    theANMATOR2b likes this.
  22. glennnn

    glennnn

    Joined:
    Sep 26, 2013
    Posts:
    10
    theANMATOR2b likes this.