- Home /
Animations with MotionBuilder (.fbx format)
Ok, I am new to the forums here and first time poster here, so please forgive me. This post is long but I have tried to give relevant background information and ask questions and marked them accordingly.
Background:
I'm new to using MotionBuilder and the FBX format but I have some success pulling a model into MotionBuilder, adding an animation, and finally plotting the animation back to the skeleton.
What I'm trying to do is to preview models with various animations in Unity 3. I have a simple scene with about 4 models and a camera and created a simple GUI overlay with buttons. The GameObjects, buttons and animation calls are defined in a single GUI Script file.
What works:
I can drag my .FBX into my test game scene. By default, "Play Automatically" is checked for the asset. If I simply click the play button to preview the scene in the Unity Player, the animations fire instantly and look fine.
Model from Mixamo.com with about 6 animations. Play automatically works, calling individual animations from button presses works.
Lerpz model from 3D Platform Tutorial. Play automatically works, calling individual animations from button presses works.
A custom model was originally created and animated in 3ds Max 2011. Then, due to the way MotionBuilder works, created the same model in the standard T-pose and exported out in FBX to pull it into MotionBuilder 2011.
In MotionBuilder, I can successfully characterize it, create a Control Rig, apply an animation and then plot it back to the skeleton. Finally I save it out as an FBX format with a single take named "Take 001".
I can call this custom model into the Scene. If I leave "Play Automatically" checked, clicking play in the Unity Player automatically (and correctly) plays the animation.
What doesn't work:
However, if you uncheck "Play Automatically" and call the animation using Animation.Play("Take 001"), the model does not animate at all.
Question 1:
So, how is it that the Unity Player will correctly play the animation when "Play Automatically" is checked, but will not play the "Take 001" when called with Animation.Play("Take 001")?
To paraphrase the great Captain Jack Sparrow: "That is maddeningly unhelpful."
Between having quickly perused the forums and answers, Google search on MotionBuilder and Unity, and through a coworker, a common theme with animations seems to be "your rig is wrong."
Question 2:
So, if the rig is wrong, why would it even play under the condition above (leaving "Play Automatically" selected)?
I noticed that selecting a particular asset in the "Project Hierarchy" and looking at the FBX Importer settings / Animations, I see that Generation is set to "Store in Root" and Split Animations is checked (even if there is only a single animation in a take).
I thought that changing "Store in Root" to "Store in Original Roots" might do something in case the root of the working models more closely match what Unity expects as part of FBX hierarchy. I tried it once to another model and clicked "Apply" but I didn't see any change.
I tried unchecking "Split Animations" and "Apply" with no visible change.
So...
Question 3:
Is there anything that explains the ideal or minimum required bone structure and root to ensure animation plays properly in Unity 3?
I have seen requests for a tutorial that explains this workflow and they have seemingly gone unsanswered.
Can any of you kind souls out there help me out and get me pointed in the right direction?
Thanks in advance!
Cheers.
-Aaron
Update since I posted this:
Today, although I am not sure why, some but not all of the animations that failed to play upon button press today were working. However, I'm trying to figure out what I may have done differently.
So, I think that the answer to my problem is in part in the way the different models I used in the scene have somewhat different hierarchies (animation attached to root or multiple roots). But, since now some of my characters that didn't play their animations from script call are working. $$anonymous$$addening!
Anyway, looking forward to any feedback. Thanks!
Answer by ajmueller · Jul 27, 2012 at 04:34 PM
Well, since I never really got much help with this question and eventually moved on to another project that didn't require animations, I recently found myself back into getting character animations into Unity and I wanted to share what I learned in case anyone finds my question and wonders what the answer was.
NOTE: I'm not an animator. For those that are and this seems trivial to you, this question and answer are not for you. MotionBuilder is one of the most complex software programs I have ever used and for non-animators, I'd say not very intuitive.
Background: Unity accepts animations one of two ways.
For those familiar with the Unity 3D Platformer tutorial (a.k.a. Lerpz), or even the Unity Construction character that is part of the 3rd Person Controller in the Standard Assets folder. In each case there is a single FBX file with one long animation track that is split in the FBX importer into frames.
The other way is how the guys at Aquiris did the animation in the Unity Bootcamp demo. This model uses a base character with mesh and skeleton, and all the individual animations are smaller FBX files that contain nothing more than the skeleton (soldier@walk.fbx, soldier@run.fbx, etc.) NOTE: This is the method I wanted to use!
So, now onto my discovery...
How to do Method #2:
Simply put, the Unity IDE is much smarter than I gave it credit for. I was looking for some complex answer and it turned out to be fairly simple. Guess I should have just tried it, but I was surprised to see that the Unity documentation didn't address the main application that generates FBX files natively (MotionBuilder).
What I'm doing now with MotionBuilder (2013 mostly, though I have 2012 on my workstation as well) is applying animations to my character with a control rig.
Step 1: The first thing to do is to save your character in a T-pose. I do this by selecting only the skeleton hierarchy and the mesh (or meshes) and choose File -> Save selection and give the FBX file a name (model.fbx for example). You can save the control rig in the FBX file but Unity doesn't understand what a control rig is, so it just ends up cluttering the hierarchy of the model when Unity imports it into the Project folder.
Step 2: Next, I apply motions to the model with control rig and bake the animations to the bones for each take. Once I have the animations on my skeleton, I use what I call the "DaVinci" menu in the Character Controls interface and select "Save character animation" (see attached screenshot). In the resulting Save As dialog box, make sure to select all three checkboxes below the file name: Embed Medias, Save One Take Per File and Use Take Name. The file name you type in the box doesn't matter when you select the "Save One Take Per File" and "Use Take Name" options.
Now, when the next dialog box opens, you have the opportunity to select one or more takes to save out (using the take name for the file).
You can name the take model_name@animation_name to get the naming convention to be recognized by Unity.
Step 3: I recommend importing model and animations by dragging the entire folder into the Unity Inspector to your project folder. Once there, if you click on the model.fbx file and look at the Animation component, you will see the array of animations populated by all the @animation files (walk, run, idle, etc.). As an added bonus, if you add another animation to the model in your project, any instance of your model in a scene should inherit that and be able to play it.
Ok, sorry for the long post. I wanted to share what I learned and I hope that someone finds this post useful. I know that for someone who is still relatively new to Unity, having this written up in the documentation would be helpful.
Moving forward... Now, the next challenge is how to create a character model so that the same base character and animations can drive different models. By this I mean, changing the mesh of a character only so that all the models that need the animations don't each need a separate copy of the same thing. Topic for another question and another time.
Answer by Zeal · Mar 19, 2012 at 05:33 AM
hello Aaron , i just wanted to tell you that i too am new to this exporting fbx and facing the same problem but i advice u to try watching the UNITY 3D TUTORIALS in youtube which may help i suppose,
Good luck Zeal
Hello Zeal, I haven't logged into Unity Answers in a long while. Since I haven't been directly involved with the animations and their creation, I let this question alone. As luck would have it, I am sort of back in a similar situation.
I think the problem is that $$anonymous$$otionBuilder is seen mostly as a tool to deal with cleaning up motion capture data. It has a very powerful animation rig (both F$$anonymous$$ and I$$anonymous$$) which can be used to do keyframe animation as well. I know that both $$anonymous$$aya and 3ds $$anonymous$$ax can output FBX files, but I just found it funny that FBX is actually the native file format of $$anonymous$$otionBuilder.
There's a lot of stuff out there, but when I was searching, I don't recall any tutorials that mentioned Unity and $$anonymous$$otionBuilder. Since it has been a while, I might have a look, but I'm not holding my breath.
The sort of good news is the animation support called $$anonymous$$ecanim that will be part of Unity 4. I can't recall the source, but at some point I had heard that the guys from $$anonymous$$ecanim were either directly responsible for or a part of the $$anonymous$$m that built $$anonymous$$otionBuilder (in its early days prior to being acquired by Autodesk). If you haven't watched the video, I highly encourage you to go to Unity's web site and click on the Unity 4 image. Two clicks will take you to the $$anonymous$$ecanim page.
That being said, for my current work, this would be a paid upgrade and I think the timeline won't suit the current project and deadlines. Also, as slick as it looks, there still is the task of using our motion capture suit and recording quality animations.
Thanks for your suggestion and good luck in your use of Unity.
Answer by ajmueller · Jul 27, 2012 at 04:48 PM
With regards to my Question #3:
While I never found a good description of what is required for the bone structure as far as Unity goes, I know that MotionBuilder requires a minimum set of bones to create a character and control rig.
One discovery I made was that the skeleton must have the same structure or the animations won't play. To some that may seem completely obvious, but I was experimenting with trying to get a reference node or reference bone to handle walk and run cycles (animation in place). As long as the exported model_name@animation_name file is exported based on the same skeleton, the animation will play. This was important as I had a bunch of characters that were based on the same skeleton. I saved out one set and just renamed the animations model1@, model2@, etc.
The good news is, with MotionBuilder, even if the base skeletons are different, it is possible to transfer motion from one to another. In hindsight, the human characters should all be modeled the same way (that's something I haven't had direct control of). Like I said before, MotionBuilder is extremely powerful software and I'm barely scratching the surface.
Again, if this is obvious to you, this follow up post was not intended for you. I hope that my struggles and discoveries will help anyone that is using Unity and MotionBuilder.
Answer by Weevilman · May 24, 2013 at 12:50 PM
This has helped me already in my project, thanks for sharing this!
Your answer
Follow this Question
Related Questions
Motionbuilder->Fbx->Unity. Loads up fine, but animation won't run 0 Answers
Motion builder models disappear 1 Answer
Applying c3d files to rigidbody modeled in unity 0 Answers
How can I import a blendshape animation using fbx file format exported from motionbuilder? 1 Answer
Modo not working well with Mecanim.. 1 Answer