Jump to content
  • Advertisement
Sign in to follow this  
Endgegner85

How To Map Animations Between Similar Skeletons?

This topic is 713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys,

 

I am still working on my game and its custom game engine. I am able to process files like FBX and extract all information I need for my game engine into my custom file format (mesh, materials, animations, textures, ...). Since I am working alone on my project and my 3D modelling skills are bad (I mean really really bad), I buy my assets online or hire artists to create models and animations for me.

 

I recently bought two resource packs online which contain almost all animations I am going to need for my game. I also downloaded several 3D humanoid models for testing. My problem is, that the skeletons do not match. Sometimes three joints / nodes are used for the spine in the skeleton or in one case there were joints for eyes. In another case, there were sub-joints for the toes of the model. Most parts of the skeleton are the same, but not the entire skeleton.

 

My question is pretty general: How do I map animations for a given skeleton to a mesh using a similar but not identical skeleton?

 

I mean, humanoid skeletons always have a head, arms, legs, etc. But what shall I do, if I have joints in my mesh skeleton which are not available in the animation skeleton?

Share this post


Link to post
Share on other sites
Advertisement

This is actually a service I offer my clients when they buy a model from me, believe your 3D artist or animator will do it for you.

 

It's tricky and not easy to teach. Basically it involves copying data from one bone, multiplying some values with a bias and then sending it to a new rig, capturing the data to key frames and deleting the old data.

 

This is often done in the 3D software.

 

 

Unreal 4 has a built in system that allows for this kind of animations, however it does expect the work to follow some rules.

Share this post


Link to post
Share on other sites
I don't have any experience, but it's a known problem with a lot of research, usually under thr name "animation retargeting". Searching for that should bring up a lot of material.

Share this post


Link to post
Share on other sites

Unity handles this to a certain extent. But since you're building your own, you'll have to look at it at a deeper level.

 

This gets into what an animation is. If you are using a library, you may have to write your own instead.

 

To a certain extent, the armatures must be the same. Any change has potential to mess up the animation. For example, if an armature has an arm with upper, lower, and hand and then you combine the upper and lower, the fact that you dropped lower from the chain is going to mean the hand will be in a totally different place. There's basically no way dropping that joint out is going to not affect the animation. I suspect substantial scaling of individual parts rather than the entire model and armature could change things too.

 

Dropping things at the end of the chain is a lot less problematic. Taking all the fingers and animating the entire hand based on just the first finger is "workable". But this changes the vertex group assigned to that first finger from one finger to all the fingers. Or if you just drop all the finger animations the arms and palm animations should still mostly work. Dropping out eye animations is workable too.

 

Basically, the armature is just a bunch of matrices linked together in chains. The matrices are the joints of the bones.

 

But your models and animations are going to have to make some effort to work together. Different bone names won't work unless you map them. So, your model is expecting certain bone names (matrices assigned a name) and as long as you map something in the armature to what the model expects you should get it to work. But the less what you give it is what it expects, the more you will have problems.

 

For example, if the model expects a palm bone and a single finger bone along with a thumb bone, your animation may contain additional finger data, but you can just throw that away and get the expected result as long as everything else pretty much matches.

 

If it's merely a problem with bone names, write an importer that lets you map the names in the animation to the names in the model. You may get away with differing lengths. And you can probably get away with dropping out bones at the end of the chain. But radical changes may never be workable.

 

For a three joint spine you may be able to collapse a matrix to make it a two joint spine. You lose that animation, but at least you can maybe make it work. Or if your models support a 3 joint spine, then you could make one of the joints optional and basically lengthen the bone to combine two bones into one. Again, it won't be animated on that unused joint, but the animation doesn't contain that joint anyway, so not much lost. All this kind of means standardizing your models to support basically the same bones and then if that bone isn't included just treating two bones as if they are one.

 

Anyway, this sort of "unreliability" of 3D models is why I'm enrolled in a 3D modeling program to become a 3D modeler while continuing to build my engine. It's great if you can find the models you need at a somewhat reasonable price, but I always find it extremely difficult to find usable assets, especially along the lines of what I really want. Another advantage of learning modeling is that it helps you understand the entire process which helps in understanding how the code needs to support that process.

Share this post


Link to post
Share on other sites

Hello,  :)

 

Thank you very much. You've helped me!  ^_^

 

I use a small tool to convert FBX files into my own custom file format. The files are then post-processed by a second tool. The result is then used by my game. Therefore, I always can make sure I only have files in a proper format without any errors. The data structure I use for skeleton joints have an enum containg the joint's type. In my post-processing tool, I take the joint's name and check a dictionary for the proper enum item. A name of "B_R_UpperArm" will be a "Right Upper Arm" for example. Since I bought a few massive animation packs I don't have that many different joint names for each joint.

 

When looking at the skeleton tree, the leaves do not concern me, as you mentioned BBeck. If I have toes in my mesh, but not in my animation, I can simply use the foot's animation for the toe. I can do the same vice versa and discard animations for toes, if my mesh does not have any.

 

My main concern way about my spine example. I searched online for the term "Animation Retargeting" as Hodgman mentioned and I found some nice tutorials about how to do it.

 

I will make some management work in the next days and make a list of all animations I will need for the very first version of my game. Then, I will check which animations are already available in the resource packs I bought online and check their skeletons. If these skeletons mainly match, I am fine. Since I need to hire someone to create the models for me, I can tell him which skeleton he shall use for rigging.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!