This project has moved and is read-only. For the latest updates, please go here.

Can CMO animations be merged

Mar 13, 2014 at 5:25 PM
Edited Mar 13, 2014 at 5:40 PM
Can CMO animations be merged ? Suppose I have two CMO clips - identical figure and rig. If file A has the figure in TPose and file B contains animation, can I use animation from file B to animate file A ? I do realize that for every animation there would have to be that extra model mesh there, but I was hoping to have some post-processing functionality that would just extract the animation in my own format and then in the finished product I would just load the CMO and then run some custom loader that would load animations that were previously extracted from "animation CMOs"

But in my initial POC testing this didn't seem to work. I have two identical CMO files, with meshes as described above, but when I try to apply the animation from fileB to fileA it gets all distorted. So my question is - is this something that can even be done ? Are those transforms in Bones affected by scaling , etc (it's possible that the two files may have differently scaled model, but otherwise everything else is equal - model, skeleton, etc)

Naturally, I could also be having some bug in my animation merge code, but just wanted to see if this is something that should work, or if I m doing something that can't be done easily.
Mar 13, 2014 at 11:12 PM
Edited Mar 13, 2014 at 11:14 PM
Heh... Looks like I answered my own question again :)

Anyway - if anyone else intends to attempt this here are the 2 problems you are likely to run into:
  1. Animations may not start from the same pose as your main model. For example your main model might be in TPose and your animation might start without TPose. The assumption is that both animations ultimately have the same bind pose ,of course , but due to the different starting position your bones InvPose and BindPose will be different between the two. This will of course cause issues since the second animation transforms will be relative to its own InvPose and using bones from the first file will mess it up. So copying just animation from such file is not enough. Bones need to be copied as well.
  2. Once I got that fixed I noticed that , while the animation was much better, it was still quite funky. This turned out to be due to the fact that ordering of the bones is not guaranteed to be identical, even with the identical skeleton and mesh. So for example, right arm in the original file was at position 3, while in the animation file it was at position 4. Since the original vertices of the model expect arm to be at position 3 when this was passed to the shader for weighing it caused a mess. The fix was remapping these by name, AS WELL AS remapping animations to the right indices.
That's it - everything seems to be working well now. And if anyone has a better way, I'd certainly be interested to hear it.
Marked as answer by walbourn on 3/13/2014 at 3:14 PM