Stumbling Toward 'Awesomeness'

A Technical Art Blog

Thursday, March 31, 2016

Why Does Everyone Write Their Own FBX Exporter?

fbx_export

When it comes to characters or character animation, any studio doing anything remotely complex has to write their own FBX exporter. But why?

send_to_unreal

It’s true that the FBX export options dialog is so convoluted that even ADSK has created a front end for exporting FBX to Unreal or Unity, but the main reason boils down to one issue: Maya FBX Export does not bake animation properly.

I *WANT* to use the FBX Exporter core (from Python). As a technical artist, I want a C++ plugin efficiently traversing the dag and baking/exporting animation. I do not want to dupe a skeleton and walk the timeline using python, calling scene update on the entire DAG every frame. The FBX Exporter doesn’t even have python exposure, so we have to eval MEL commands; it’s just not ideal to say the least.

Where Have the Attrs Gone?

When exporting characters elsewhere, you want to use FBX to get important data there as well. Not just an animated transform. In this test file [fbx_test], you see a sphere, skinned to a joint. That joint has an attribute called important_data. In games especially, we can use this scalar to drive a material parameter such as a wrinkle on a face, a blendshape, to allow an animator to blend off a cloth solver, anything really. So here’s our important data, driven my a multiply-divide node:

Capture

Export this scene as an FBX, being sure to tell it to bake complex animation:

mel.eval("FBXExportBakeComplexAnimation -v true")

Now import it back into an empty Maya scene, your important_data is gone!

To make matters worse, in the FBX ascii file I see an anim curve for my important data:

;AnimCurveNode::important_data, Model::joint1
C: “OP”,1519473056,205108448, “important_data”

So I am at a loss as to why programs using the FBX SDK do not get this data on import, including Maya.

DISCLAIMER: On multiple occasions I have reached out to ADSK asking them to please address this issue, but it has not happened. From the image above (new game export options), you can see that, on some level, ADSK wants to make this experience better, so please echo me in asking them to fix this issue.

In line with the title of this post, I have written, and would gladly give out an exporter for UE4, but as it uses the C++ bake / FBX Exporter from Maya, I would prefer to wait until this gets fixed. The ‘Bake Root’ option was actually created by Kevin Vassey at Epic because UE4 imports custom attrs on the root joint, so we just bake that if needed. This is a little puny exporter; internally we use Jeremy’s A.R.T. Toolkit for exporting animation in production.

uExportt

 

UPDATE 1: Thanks for the shares and responses. Some of you have told me that you have also talked to ADSK about this, and others say it was fixed at one time, but is now broken. ADSK has reached out in the comments and has created a bug number in their tracking system. I will update later on it’s priority/timeframe if I get more info!

UPDATE 2: I can verify, this is fixed if you grab FBX 2016.1.2 or later from here. It should be fixed in future versions of Maya, and the bug was fixed before I wrote this post, but was not in Maya 2016. In the comments, Chris Dardis said that the fix was available in a non public cut of Maya he was using. As the link is not compiled, I have uploaded a compiled Maya 2016 FBX 2016.1.2 plugin here.

posted by Chris at 10:01 PM  

13 Comments »

  1. Hi Chris,
    Thanks for posting this.

    I’m not getting the same results that you are getting. When I export all with bake animation enabled and re-import the file into Maya I get the Important Data attr just as it was from the source Maya scene.

    But to be clear on the issue: you are expecting the resulting fbx file to contain the baked anim curve for Important Data in order to be imported into Unreal?

    Can you provide me with some details:
    1. What version of Maya?
    2. What version of FBX sdk?
    3. Full export code for the scene. (For example: FBXExportBakeResampleAll true or false?)

    For your reference I’ve created a issue# to track this: FBXX-1150

    Comment by Andrew Grant — 2016/04/01 @ 1:44 AM

  2. BTW I tested with Maya 2016/FBX 2016 above.

    As a side note: Now that Autodesk has its own game engine (Stingray!) we are consuming our own dog food here. FBX is the format we use with Stingray, so it matters to us that it works as expected.

    Comment by Andrew Grant — 2016/04/01 @ 2:15 AM

  3. Chris, if you have ever been on the Autodesk Betas, you would see that I pestered them non-stop about custom attributes missing between importing and exporting through various DCC’s and even the same DCC. They would correct the issues and then they would be lost in various service packs. Once the releases were no longer FBX owned and became DCC owned it seemed to have been a lost cause waiting for integrated fixes in the Service Packs. I couldn’t test every beta to keep in top of it sadly. I’m right there with you I feel like every other week I contemplate writing the C++ export for the animation exporting. Feel free to shoot me what you have if you are willing. We are using a modified version of Jeremy’s exporter at the moment. It would be a great timesaver!

    Comment by Randall Hess — 2016/04/01 @ 2:44 AM

  4. Hi Chris,

    As luck would have it, I was reading the notes for what is fixed in Maya 2016 ext1, and I saw this;

    MAYA-51652 Maya FBX Export does not support export of custom attributes driven by other custom attributes

    Haven’t verified it, but perhaps the Autodesk fairy listened to your wishes?

    Agree 100% Mel only commands is a right PITA!

    Comment by Chris Dardis — 2016/04/01 @ 4:32 AM

  5. While your statement that the fbx bake option will only bakes basic transforms is true, if you use bakesimulation in maya to bake all your channels the fbx will store custom attributes just fine.

    Comment by Jay — 2016/04/01 @ 7:32 AM

  6. Hi.

    When i import your testscene, my “Important Data” Values are not gone!
    I cannot reproduce your Problem. The import works as intendet.
    (Maya 2016 SP5)
    https://goo.gl/photos/MkEkYo9udZhm2B3P8

    Comment by Guido Neumann — 2016/04/01 @ 9:08 AM

  7. Sorry, made an mistake! To early in the morning!
    You are right. The Data has vanished!

    Comment by Guido Neumann — 2016/04/01 @ 9:15 AM

  8. I made a test with Motionbuilder.
    I loaded your Testscene into Mobu -> No Animation on that custom attr.
    I set keys on that in Mobu and imported it into maya -> There are values on that attr.
    Then i made a new custom attr with anim inside mobu and maya reads it as intended

    So it seems the export out of maya is destroying the data not the import

    Comment by Guido Neumann — 2016/04/01 @ 10:34 AM

  9. @Jay – ‘bake simulation’ is destructive. The FBX bake on export is non destructive.

    Comment by admin — 2016/04/01 @ 10:46 PM

  10. @Andrew, sorry, many comments were in the WordPress spam folder. I will reach out to you via email and update my post. I think maybe you export the whole scene, for games we select the skeleton, the rendermeshes it deforms and ‘export selection’, we don’t export constraints or anything else. Thanks for your quick reply and sorry I didn’t see this in the morning.

    Comment by admin — 2016/04/02 @ 2:28 AM

  11. Hi Chris,
    There was a fix for exporting custom attributes animation on 11/2/2015. Any plug-in before that date was not exporting the animation on custom attributes. I’ve tested using FBX 2016.1.2. I’ll see if I can find the exact release version it was first introduced.

    And also note, that the presence of an AnimCurveNode does not automatically imply there is animation data. For that, an AnimCurve needs to be connected to the AnimCurveNode.
    Thanks!

    Comment by Andrew Grant — 2016/04/04 @ 5:06 PM

  12. […] And if you’re upgrading to EXT2 today, don’t forget, FBX anim export/bake is fixed! […]

    Pingback by Stumbling Toward 'Awesomeness'ADSK Ships PoseSpaceDeformer, Ignores Clavicle A Technical Art Blog Stumbling Toward 'Awesomeness' — 2016/04/19 @ 3:41 PM

  13. This blog was… how do you say it? Relevant!! Finally I’ve found something that helped
    me. Thanks a lot!

    Comment by ubot studio — 2016/11/09 @ 12:55 AM

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress