Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /home/public/wp-includes/plugin.php on line 601

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /home/public/wp-includes/plugin.php on line 601
retarget animation tool for MotionBuilder « eduardo simioni
eduardo simioni

retarget animation tool for MotionBuilder

by on Feb.02, 2011, under MotionBuilder

Finally added some new features, some polish on the code and updated the script on github. You can use it to retarget any amount of animations over your characters without much hassle. You can download it here.

You just need a scene with an already characterized character and a folder with animations in .fbx. The animations need to be either already characterized or not. If they are not, they need to be on a tpose on frame 0 and have either Motionbuilder (with or without a prefix) or 3dsMax Biped nomenclature. They need to be characterized to be retargeted from one control rig to the other, so that’s why it needs a tpose. For a custom bone mapping you can easilly add a new one or edit the mobu one.

I might add bvh support in the future (maybe with FBFileBatch()?) when I find more free time again. Or feel free to add it yourself.

* edit: Ok, added support for bvh, namespace, and custom skeletons. You still need to edit the bone mapping if you have custom skeleton though.

:, , , , ,

2 Comments for this entry

  • George

    Hi and thanks for writing and sharing this script. I came across it when looking for a Maxscript to batch convert/retarget multiple bip files and re-export as FBX to Unity. Unfortunately the Maxscript route seems unlikely (apparently Maxscript has no access to Character Studio)so your python script seems like it could be what I’m looking for. I’d never used MB before but your script gave me reason to give it a try.

    So far I’ve been struggling to get it to work & keep getting the following:

    Traceback (most recent call last):
    File “C:/Users/Morpheus/Desktop/retarget/retargeter.py”, line 492, in
    main()
    File “C:/Users/Morpheus/Desktop/retarget/retargeter.py”, line 458, in main
    oldAnimRoot = FBFindModelByName(“merged:” + prefix[1] + userRoot[1])
    NameError: global name ‘FBFindModelByName’ is not defined

    I’ve tried various Biped naming conventions to get around this problem. By default it asks for the Pelvis name as “Bip 01” which I changed to “Bip Pelvis” (to match Max’s default). I’ve also tried adding a semi colon (in max to force rename all bones) and tried default settings. I’ve also tried removing the Bip prefix prior to export (from Max).

    What I’m trying to accomplish is a nice pipeline to retarget all of my approx 100 fbx animations (biped anim). I have a characterized biped in MB with a control rig which I’d like to batch import/retarget/export all the FBX anims. Strangely I cannot load FBX anims (in MB)onto a characterized rig without also characterizing the FBX animation file as well (even though both are using the exact same source rig (back in 3dsmax)).

    What happens is, I drag it into the viewport and it adds itself as a new set of bones with a suffix to the bone names (eg. Bip L Thigh 1). Only after characterizing the bones from the anim data, can I then target it’s data onto my original character. I guess this is retargeting between two identical rigs. Is there no way just to load the FBX data onto the first characterized file?

    These anim files also don’t start in T-Pose (though I’ve edited one and placed it in a new folder for just testing your script). I’m assuming I’ll eventually need to edit all one hundred anims to include a T-Pose on frame 0. I’ll then have to get rid of the T-Pose back in max (and shift all the keys back to zero) since they’re used in Unity3D and I can’t have them start in T-Pose.

    • eks

      Well, first you shouldn’t need Motionbuilder to generate animated .fbx from Max. Unless the skeleton you have in Unity is not the same one in Max you should be able to just export as fbx from Max directly.

      As for the error you are having it’s because you are probably missing “from pyfbsdk import *” at the beggining of the script. The error message is saying FBFindModelByName is not defined, meaning python can’t find it in the scope it was used. FBFindModelByName is a function in pyfbsdk module, which is Motionbuilder’s python sdk (pyfbsdk.FBFindModelByName()).

      Lastly, you can also try “Load Character Animation” in the Character toolbox to load an animation exported from Max over your Mobu character. The retargeter is useful if you want to retarget animation from two different skeletons, say animations on a human over a dwarf. If you are moving animations over the same skeleton you don’t need any of this.

      But most importantly, you shouldn’t need Motionbuilder to export animations from Max to Unity. :)

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!