Search Unity

Unity Mecanim Retargeting for 2D characters

Discussion in 'Editor & General Support' started by dchen05, Jan 6, 2013.

  1. dchen05

    dchen05

    Joined:
    Aug 28, 2012
    Posts:
    45
    So here is goes:

    My main goal is to be able to use the MecAnim re-targeting system with a single mesh 2D character.

    The major setback is that I am not able to set the character start pose to the desired T-Pose position, because characters are user generated and are in the knees out, feet out position. (Typical 2D pose)

    Here are things working correctly in maya. Here is my characters standard pose.
    $robo.PNG
    Here is the pose that has been modified. This is working good. I am using a rigid skin bind.
    $diffPose.PNG


    Here is the same animation in unity. Notice the odd bending and warping of the characters legs in 3D space. This is not good.
    $bendy.PNG
    $bend2.PNG

    I have so many questions. Why does it do this? Is there any way for me to get the skin to bind like it does in maya and still use mecanim retargeting?

    Is there anyone out there trying to use MecAnim for 2D? I hope im not the only crazy person attempting this. Please help.

    Alternatively, If i split this mesh up into 10 parts for each limb. Would it that work? or does it need to be a single mesh.
     
  2. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    I haven't tried retargeting 2D characters so its a wild guess here but the bending at the knee could be caused by :

    1) The system trying to do IK with your feet. Make sure you uncheck the IK in the animation states.

    2) Some settings in the muscle tab when you are retargeting. Adjusting the twist and per-muscle settings there could fix the problem.

    Does your model look okay in Unity when using Generic instead of Humanoid ?
     
  3. dchen05

    dchen05

    Joined:
    Aug 28, 2012
    Posts:
    45
    Thanks for the reply,

    1) IK is unchecked, I don't think its an IK problem.

    2) I've been messing with muscle settings. I will keep digging and see if I get anything.

    If I import my model and animation together in one file, and keep the import Rig settings to generic it looks like this. Which is good.
    $correct.PNG

    It seems to be a problem when importing then animation and the model separately, then applying the animation to the model with re-targeting, but that can't be avoided because its the whole point of this project.

    I will keep updating this thread with what I find because I haven't been able to find many people using mecanim with 2D.
     
  4. dchen05

    dchen05

    Joined:
    Aug 28, 2012
    Posts:
    45
    Latest Findings:

    Its becoming clear that Mecanim retargeting doesn't want to work with pure 2D characters. Here I tried importing the character in 9 separate parts, expecting it would work like a paper doll, which is how I rigged it in maya. However, unity assumes my character is a 3D rig and is moving the joints accordingly. You can see the pieces of paper intersecting instead of lying flat ontop of each other in the middle character.

    $snaps.PNG

    This is kind of a shame, because the retargeting is there, Unity is just "doing too much" and trying to prevent my characters bones from breaking and going in what it considers odd directions for a 3D rig, yet for 2D animation, that is exactly what I want.

    Unity dev's, any plans on the roadmap to consider mecanim retargeting with 2D?
    Will opening up access to the mecanim API allow someone to be able to turn this behavior off?
    Would there eventually be a way to use retargeting with the raw transform values of each animation, without unity assuming a 3D rig?
     
  5. mcroswell

    mcroswell

    Joined:
    Jan 6, 2010
    Posts:
    79
    dchen05: This was my conclusion as well. I tried a few months ago to get this to work for my chapter on 2D for a upcoming book. I gave up, after spending much time on it, like I see you did. I feel your pain.

    As you know, 2D paper-doll/cutout is topologically different from a humanoid rig since the it's not just a matter of throwing X Y rotations away. The Z rotations are really special and it's understandable that it doesn't work. Unity would need to add sets of different muscle configurations (eg, quadraped, paper-doll, etc) for this to work smoothly.

    My paper-doll is like your second approach. I also used overlapping quads. I wish I could find the old post I got this from. It was years ago, and the inventor was doing a Ninja or Shogun, or such.

    I'd like to see the answers to your questions, as well!

    Thankfully the old Animation system still exists, I just hope Unity puts a little more love into it (copy/paste keys).

    Ideally, it would be cool if newer versions allow the Animation ones to be more fully integrated into the Animator - that is, used from it.
     
    Last edited: Feb 6, 2013
  6. dchen05

    dchen05

    Joined:
    Aug 28, 2012
    Posts:
    45
    @mcroswell, thanks for the response.

    After playing with this for a bit it became clear that Mecanim retargeting wasn't going to work. Mecanim was designed for 3D skeletons and is heavily dependent on the T pose, which is fine. (Although I do think in their marketing they should specify 3D, because they use the word "biped")

    After lots and lots of work, I have a custom 2D Mecanim retargeting system working! Woot woot! It's a crucial for my current game Grafighters.

    This is a very custom solution but if there is interest its possible I could figure out a way to broaden it and possibly release it as an asset. I could start with a basic one for now. Hopefully in the future my goal would be to release a version thats hooked up to the Grafighters API (so you can easily use all the user generated characters from our world).

    Heres a screencap, maybe tonight i'll record a video.

    $forWeb.jpg
     
  7. dchen05

    dchen05

    Joined:
    Aug 28, 2012
    Posts:
    45