How to retarget animations?

I am working on improving the animations for my game while upgrading to the new animation system, and I am looking to find the best way to retarget animations between 2 different skeletons.

It is looking like the Maud editor will be my best choice - I recall a long time ago seeing a video using Maud to retarget animations, but I did not bookmark it, and I cannot seem to find it again unfortunately. I tried to retarget an animation by trial and error a few weeks ago, but I got stuck on the bone mapping step.

I am also curious if animation retargeting is supported for the new animation system? Or if I should retarget my animations using the old anim system and then migrate to the new system afterwards.

1 Like

Maybe this helps, it’s for the old animation system, so you need to do the migration afterward I think.

In my case I retarget BVH animations to a T posed dummy character in Blender and export it as Gltf then in JME I load that dummy character and retarget animations from him to my other characters. For example you can use sgold Wes library to do it.

3 Likes

The new animation system is supported, but not in any release, so you’ll have to build Maud from source.

2 Likes

I am trying to use Maud to create a skeleton mapping to retarget animations from a store bought model onto a MakeHuman model, but I’m having trouble.

When I link the bones, the bind poses don’t match (which is expected since they have different skeletons). So then I tried using the axis arrows to apply bone twists to eeach linked bone, similar to how you did in the demo video, however I can’t seem to get the bind poses to line up no matter how much I tried twisting the bones.

Here’s how it looks after I tried linking all the bones, but the upper body of the make human model is always stuck bending over regardless of how I link/twist the waist and spine bones:

And then when I play an animation (like the stand-up animation in this video) the make human model also is floating as if the rootBone isn’t linked properly:

So I’m not sure if I’m doing something wrong, or if is potentially an issue specific to the models I am using.

1 Like

Perhaps one model is Y-up and the other is Z-up? Just speculating here…

1 Like

They both appear to be normal y-up models

1 Like

Below is the workflow I’m going to follow when I buy animations from a 3D store:

Is that all you need?

1 Like

It’s entirely possible you’re encountering a bug in Maud. As the author, I feel responsible for troubleshooting the issue.

In order to do so, I’d want to know the exact version of Maud (the Git commit if built from source, otherwise the download version), and I’d want access to both models (not including textures).

2 Likes

I re-built maud from source fairly recently, and based of the file it looks like I downloaded the master branch on 10-17-24. So just under a month ago.

In which case the last commit before I built Maud from source should be this one on 10-13-24

And here is a link to download a folder with the 2 un-textured models I am using. The target model is called “basefFemale_animRig.j3o” and the other one is the store bought source model I am retargeting the animations from:

Another potentially useful thing to note: The store bought model is from the same artist/animator that made an armored dark elf model that I sent you a while ago when you helped fix a bug with ragdoll physics that only seemed to occur with that model. I’ve had a lot of strange issues with the animated models I purchased from this artist, so I wouldn’t be surprised if there is something similarly strange with this model that is triggering the issue again.

Let me know if you need anything else to troubleshoot the issue. And as always, the troubleshooting support and frequent updates you provide for your libraries is greatly appreciated.

1 Like

Using the Maud app (latest build from “master” branch), I created a quick-and-dirty skeleton mapping from the mercenary model to the elf model. I mapped just the major bones (no fingers) and didn’t try to fine-tune the angles. Here is a save of my work, in case it’s useful to you:

Along the way, I didn’t notice any major bugs. However, the user interface is rather tricky. Some pro tips:

  1. Before attempting to create a mapping, get familiar with various ways to reposition the camera in Maud.
  2. Add an asset location and load both models.
  3. Put the source model into “bind pose” and the target model into “retargeted pose”.
  4. Open both the Mapping tool and the Twist tool.
  5. Work from the root bone toward the extremities, skipping over any bones not present in both models.
  6. Double-check the selected bones before clicking on the “Map” button. (Several times I spoiled my progress by selecting a source bone and then clicking “Map” before I’d selected a new target bone.)

I mapped 21 bones. For many of them I didn’t need to use the Twist tool at all: Maud generated good rotations automatically. But in the case of the Pelvis, I had to adjust the xTwist to -123 degrees. I think that’s the key to getting the correct overall orientation.

2 Likes

It looks to me that the root bone is not translating from its place at all maybe even not rotating
So maybe there are not animations transferred to the target root bone

2 Likes

Nehon’s animation retargeting algorithm handles bone rotations (including the root bone) but not root translation. Maud has 2 strategies for dealing with root translation, both found in the Track menu:

  1. translate for support
  2. translate for traction
3 Likes

I think my issue must’ve been due to the order I was mapping the bones, I was not doing them starting from the root bone in my original attempts.

This is unfortunate, I think I may not be able to use this method of retargeting animations, since many of the mercenary’s animations rely on translating the rootBone.

The “translate for support” feature did appear to work to fix the model’s feet to the ground so it isn’t floating, however it still results in the loss of some important keyframes. For some animations it is not noticeable, but for others it is very noticeable that the rootBone keyframes were lost.

For example, many of the run-in-place animations appear to rely on translating the rootBone up and down slightly to make the characters head bob slightly up/down, but when I retarget and tried to translate for support, the animation loses that efffect and is just anchored down to the ground and appears like it is sliding with the head always at the same altitude, and no longer appears to have any head bobbing.

Is there a good reason that nehon did not include root translation in the retargeting algorithm? Is it something that could easily be added, or is this one of those things that is not as easy as it sounds?

Even though most devs (myself included) entirely avoid root-motion animations and only use in-place animations, it appears that many animators will still create in-place animations that use minor root bone translations. So I think it would be important to add support for retargeting root bone translation to jmonkey if it is possible.

1 Like

You’d have to ask @Nehon about his reasons, only he doesn’t hang out here any more.
You’re welcome to look at the source code and submit PRs. The key classes/methods are:

SkeletonMapping: Wes/WesLibrary/src/main/java/com/jme3/scene/plugins/bvh/SkeletonMapping.java at master · stephengold/Wes · GitHub

and AnimationEdit.retargetAnimation():

2 Likes