Search Unity

Animation problem when exporting from Maya to Unity.

Discussion in 'Editor & General Support' started by nielsvaes, Mar 11, 2013.

  1. nielsvaes

    nielsvaes

    Joined:
    Jul 29, 2012
    Posts:
    18
    I've been having some very weird problems when exporting my animation made in Maya to Unity. Everything seems to be working fine, except the last 2 joints in the fingers. They're animated in Maya, but the animation isn't imported correctly in Unity. The character makes a fist in Maya, but the joints in the fingers don't rotate the correct way in Unity. They seem to be rotating down, instead of inwards

    Take a look at the following video:



    I figured there was something wrong with the skeleton, or maybe the local rotation axis in Maya, so I uploaded the character to Mixamo's website and let them autorig it. I used it before and it worked without a problem, so I figured I'd give it a try again.

    Same thing happens again. When the finger joints are rotated to make a fist, the joints rotate down towards the character's feet in Unity.


    Take a look at the following screenshots:

    All joints are recognized correctly in Unity:
    $inspector.png

    Joint animation in Maya, the joints rotate towards the character
    $Screenshot_1.png
    $Screenshot_2.png

    Joint animation in Unity, the joints rotate down to the character's feet.
    $Screenshot_3.png
    $Screenshot_4.png


    The weird thing is that this only happens for the joints in the fingers. All the other joints in the skeleton work fine, as you can see in the youtube clip. So I'm really at a loss as to why this is happening.

    I tried rotating the local rotation axis of the joints in Maya, because maybe they were wrong, but it doesn't make a difference.

    Also, when rotate the fingers down in Maya, towards the character's feet and import that animation into Unity, the fingers actually rotate down. So it's only a problem when the joints are rotated along the X axis in Maya, for some reason Unity doesn't like that.


    Does anyone have any idea why this is happening? Any help on the subject would be greatly appreciated.
     
  2. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,044
    How many bones are influencing the vertices there? You may have more than two and your settings for skinning be set at only two influences.
     
  3. nielsvaes

    nielsvaes

    Joined:
    Jul 29, 2012
    Posts:
    18
    Thanks for replying. I just checked and that doesn't seem to be the problem either.

    Just to be sure, I reskinned the model, allowing 4 joints to influence the vertices and imported that into Unity. The same thing happens.

    I'm beginning to think this is a bug in Unity...

    For anyone who's reading this, have you successfully made an animation with finger movement and imported it into Unity? If so, can you maybe share your Unity project so I can take a look? It would be super sweet if you've made it in Maya and are willing to share that file :)
     
  4. nielsvaes

    nielsvaes

    Joined:
    Jul 29, 2012
    Posts:
    18
    Ok, so after playing around with it some more, I think I isolated the cause of the problem. So that kind of gets me halfway to a solution, right? :)

    Take a look at the following video, preferably in HD so you can read the on screen text:



    When I import the Maya file without making an Avatar, the animation plays fine; the finger bends the way it does in Maya. After that I make an Avatar out of it and the finger bends funny. So I'm guessing something goes wrong when the Avatar is created, but I have no idea what.

    I tried some Mixamo animations just to make sure it has nothing to do with Maya and I get the same behavior when using Mixamo animation files.

    Soooo... does anyone have any idea what's going wrong?
     
  5. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    If your animation works fine as generic it means the problem is related to humanoid setting. In the past I have seen loss of accuracy when using humanoid setting. When creating your avatar are you sure that the bones are mapped correctly in the hand ? You do it automatically but never check that in the video if the hands are mapped correctly (even if it seems like it is). Other suggestion is to play with the constraints in the muscle tab and see if it makes any difference if you set some constraints.
     
  6. nielsvaes

    nielsvaes

    Joined:
    Jul 29, 2012
    Posts:
    18
    You are 100% right. For some dumbass reason I hadn't tried the Generic Animation Type yet. When it's set to Generic, everything works fine. So it's definitely a Humanoid Animation Type problem. And yes, as you can see in the screenshot above, all joints are correctly mapped.

    It would be nice to know just why exactly this is happening with the Humanoid Animation Type. Does it really need actual human proportions?

    From http://blogs.unity3d.com/2013/02/07/automatic-setup-of-a-humanoid

    Maybe these guys are too unproportional (that's not really a word I think :)) and something could be added to Unity to fix a setup like this.

    Anyway, thanks for the suggestion Alf, you're my hero of the week :)
     
  7. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,558
    You need to ensure that the character is in a t-pose in the humanoid setup. Click Configure on the Rig tab of the ModelImporter and check that the character in the Scene View is in t-pose. If not, rotate the bones so they are properly in t-pose.

    You can also check the result in the Muscles tab of inside the avatar setup editor.

    Rune
     
  8. nielsvaes

    nielsvaes

    Joined:
    Jul 29, 2012
    Posts:
    18
    What I've been doing is clicking the Enforce T-Pose button on the bottom right. I assume this is not the way to go then?

    The only joints that are giving me an error when I'm in the humanoid setup are 2 thumb joints which I don't use. The joints in the index finger and the middle fingers are green, so I assume they're correct.

    This is what the humanoid setup looks like when I click configure:



    I tried rotating the red joints until they turned green, but I couldn't find an angle that worked. I figured that was what the Enfore T-Pose button is for, is it not?
     
  9. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,558
    The t-pose has to have the palms of the hand facing downwards. The "Enforce t-pose" action goes a long way of enforcing t-pose but it's not perfect and the end result have to be manually inspected and corrected if necessary.

    Rune
     
  10. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    45
    We're on Unity 4.5.5f1 and, indeed, found the problem to be with our rigs not being in T-Pose. In our case, two factors seemed to contribute to the problem…

    1. We downloaded Mixamo animations with no models/skins attached. We wanted the animations for retargeting purposes.
    2. We downloaded Mixamo animations in .FBX format, when we should have chosen the ".FBX for Unity" format.

    Note for the Unity folks: It would be helpful for users to understand the process by which Unity determines the root pose when creating Humanoid Avatars from .FBX imports. Like where that T-Pose is coming from or how it is being generated. Something in there feels 'switchy'. Maybe there's a doc page we missed?

    = thanks
     
  11. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    45
    Update. Here's what we did to meet our need. Our need being, to have generic character animations that retarget to any given unity humanoid rig, and to not pollute our import pipeline with models we don't need.

    My hypothesis WRT how Unity determines the t-pose when creating a humanoid rig appears to be correct. It seems to first look for a model (bindpose) and, if it can't find a model, looks to the first keyframe in the animation (or possibly an average of all keyframes). So, we made sure our first keyframe is in t-pose, deleted our mesh from our models, create a t-pose and *whatever ranged clips from the animation in Unity. Voila - the humanoid rig is in t-pose - no more floppy feet. Actually, we started with an animation sequence in Mixamo containing a t-pose + run animation (for example) - but you get the point.

    Again, Unity folks: It seems you have some switchy logic in there. I would love to see those decisions surfaced in the Rig Inspector UI panel as options. i.e. you see or don't see my model and animations and, give me a choice of where the rig comes from. Perhaps 1) Model 2) Selectable animation keyframe 3) Best guess/fit algorithm.

    = thanks
     
  12. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,779

    Hey @UGetNThumpD

    Are you saying in the quote I pasted - you are animating cycles - then importing JUST THE SKELETONS/RIGS without mesh/skin and re-targeting them onto a complete character including mesh and extra hierarchical data in Unity?

    This process is on my TO-DO list to test out to see if I can improve my personal character process but I'd be interested in hearing more about your process if this is in fact what you are doing.

    Thanks.