Answered

Animation different in playmode/timeline compared to editor

Yokenstein 3 years ago updated by Peter - Soxware Developer 3 years ago 15
I would preferably just like to use Humanoid projects, instead of Generic. I know there Humanoid is a lossy format, but is there a way that accuracy can be preserved in the output .anim files? I remember solving this issue 5-6 months ago while using Humanoid, but I forgot how I managed to do it. 
UMotion Version:
Unity Version:

Answer

Answer
Answered

Hi Shayan,

thank you very much for your support request.

Yes humanoid is a lossy animation format, but for regular cases like a walking, idle, swimming,... animation the loss in precision shouldn't be very noticeable. If you're precision loss is very extreme, make sure that your humanoid character is setup correctly:

  1. Select your character's 3D model file (in Unity's project window), open the "Rig" tab in the inspector and click the "Configure..." button.
  2. The humanoid avatar editor opens.
  3. Make sure that you've assigned all bones to the correct slots.
  4. Also make sure that your character is in a T-Pose.

I also recommend that you do not have any scaling (that is not 1) on transforms (except the root) of your character.

Exporting to FBX (use write mode = "Update Existing File" to export directly into your character's FBX file) often also improves quality a bit.


If that doesn't help, please provide some further information about your specific situation.


PS: Also make sure that you are using the latest UMotion version from the asset store.

Best regards,
Peter

Answer
Answered

Hi Shayan,

thank you very much for your support request.

Yes humanoid is a lossy animation format, but for regular cases like a walking, idle, swimming,... animation the loss in precision shouldn't be very noticeable. If you're precision loss is very extreme, make sure that your humanoid character is setup correctly:

  1. Select your character's 3D model file (in Unity's project window), open the "Rig" tab in the inspector and click the "Configure..." button.
  2. The humanoid avatar editor opens.
  3. Make sure that you've assigned all bones to the correct slots.
  4. Also make sure that your character is in a T-Pose.

I also recommend that you do not have any scaling (that is not 1) on transforms (except the root) of your character.

Exporting to FBX (use write mode = "Update Existing File" to export directly into your character's FBX file) often also improves quality a bit.


If that doesn't help, please provide some further information about your specific situation.


PS: Also make sure that you are using the latest UMotion version from the asset store.

Best regards,
Peter

The model's configuration is set to T-pose. Also, I tried updating the animation to FBX but the result is the same. It's a walk animation, and the problem is with the arms and elbow pole positions, their precision is off by quite a bit.

The only solution I can think of is to create a separate generic project, add in IK handles, and the copy the keyframes from the humanoid project, export as generic, and then convert to humanoid using the animation converter. That's the only solution I can think of at the moment

EDIT: Tried converting the animation to generic, imported into generic umotion project, but now its missing the root motion. I tried setting root motion in game objects settings, and then set root bones inside umotion, but still nothing. I think I will have to stick to humanoid but the accuracy on the elbow poles are throwing the walk animation off

The generic converted animation is moving with root motion inside the Unity inspector preview, but upon importing it into the generic umotion project, it doesn't move, even when setting the RM the same as the one in the game objects settings

EDIT: I copied the keyframes from the humanoid project into the generic one, and then it was following root motion despite the clip not having RM set. However, upon exporting it, when I click "loop pose" under loop time in the animation clips inspector, it moves with root motion, but then comes back to original position after the animation ends, this is undesirable. It works fine in humanoid exported clips though. I'm running out of options, don't know what to do 

Also, I am using Version 1.23. I'm not sure if upgrading to 1.26 will fix the issue, but it's worth a try I guess

Update: Tried 1.26, exported (overwrite) into FBX, and although its a bit better, the arm/pole rotations are stlil not accurate as they are shown in the umotion editor

Update 2: I might have pinpointed the issue, deleting any additive or override layers seems to preserve export accuracy the most out of all the other methods. I am not sure if this is a bug, or why this is causing the issue. 

Hi Shayan,

when you are exporting to FBX, the animation always is "generic". "Generic" means that the animation is played "as-it-is" without using Unity's "humanoid" animation re-targeting engine. Unity then generates the humanoid version of your animation as it re-imports the FBX file. More information about what humanoid is, can be found here: https://blog.unity.com/technology/mecanim-humanoids

Here is what you can try:

  1. Export your animation into your character's FBX file using the "update existing file" mode. You can use override/additive animation layers in your UMotion project, they shouldn't have any negative impact on the animation quality.

  2. Now let's verify if UMotion did export the animation correctly. Duplicate your character's FBX file and change it to "generic". Now preview the animation you just exported as generic. It should look exactly like the one you've authored in UMotion.
    If this is not the case, please send me a bug report including your UMotion project file, and your character's humanoid FBX file (export both as a *.unitypackage so that all settings are included). I would then like to further investigate.

  3. If the generic version plays correctly, the problem is in the conversion to humanoid (which is done by Unity, not by UMotion). If the problem is related to the elbow rotation, make sure that your elbows are oriented correctly in your character's humanoid avatar T-Pose. If there rotation is offset in the T-Pose, the elbows are going to be offset in every animation.

Please let me know if that helps narrowing down your issue.

Best regards,
Peter

I exported the animation as "update FBX". And the animation is playing differently when I drag and drop the duplicated generic FBX model into the animation preview window. In fact, the animation is staying still in a t-pose in the preview. I would like to send the files over, what email do I send it on?


And the animation is playing differently when I drag and drop the duplicated generic FBX model into the animation preview window. In fact, the animation is staying still in a t-pose in the preview

When the character stays in T-Pose, then you are trying to play a humanoid animation on a generic character or vice versa.

You need to preview the generic animation with the generic character. Also make sure that your "update FBX" export really targets your character's FBX (not an FBX file that contains just animations for your character, but not the mesh itself).

Sorry forgot to include the link in my previous message. You can send the files to me via the email support form: https://www.soxware.com/email-support/

If the file size is too big for an email, please request a link to my Dropbox by sending me an email via the email form.

Best regards,
Peter

Ah yes, the animation is playing and working perfectly in the generic one. I was playing the dragging/dropping the generic character onto the humanoid animation instead of the duplicated generic one, my bad. There might then be an issue with the model, and I could always use a generic version of it but generic characters are not timeline friendly. Their loop pose instead of "continuing", it repeats from the original position, which is a deal breaker for me. Anyway, I've attached the files and sent them to you on the support form. Thanks again!

Thanks for sending me the files. I've exported the walk animation to the fbx and for me, I can't really see a difference between the UMotion preview, the generic and the humanoid version of the character. I've put all 3 versions next to each other and played their animations in sync (from left to right, UMotion, Humanoid FBX, Generic FBX):

Please note that very subtle offsets are expected results of the humanoid animation system (even when everything is configured correctly). That's just the trade off that you have to take when using humanoid. But usually, these are not noticed by the players as they are focused on the game play :-)

Best regards,
Peter

There is a slight difference on my end. Here is the humanoid version which has it's elbows clipping inside of the body

And here is the Generic version which is playing exactly the same as in Umotion

These are noticeable in gameplay and timeline both because the character is seen from the back, and any glitchy artifacty movement breaks the immersion. I cannot use the generic version because it doesn't allow me to use root motion properly, either in gameplay (mecanim) or in timeline. The root motion resets back to the original position instead of "continuing" onwards

What you're seeing is an expected quality loss that comes as a trade-off of the humanoid animation system. I'm not an expert on Unity Timeline, but I think using a generic character with root motion should be supported (if setup correctly). And if you need this quality of precision, I would also recommend going that route. But as this is related to general Unity stuff, it's out of the scope of my support capabilities. I recommend consulting the Unity manual or the Unity forum / Unity support for help regarding Unity timeline and setting up root motion for generic characters.

Best regards,
Peter

I managed to solve the generic root motion problem just now. For anyone who has the same problem: I had to use the correct root node in the FBX import settings, for the 'duplicated' generic FBX containing the animation, and then disable all 'bake pose' checkboxes as well as 'loop pose' in the animation.

Thanks again for taking out the time to help in all of this, really appreciate it! I've been trying to get this one animation done correctly for 3 days, and if it wasn't for your guidance, I honestly would never be able to know that I can export the animation to FBX and then duplicate that FBX to generic to get the lossless animation, so thank you

That's great news. Glad to hear that you've been able to find a solution.

Best regards,
Peter