Jump to content

Running animations in fbx exported to babylon is messed up

Go to solution Solved by Romanichel_2.0,

Recommended Posts

I've downloaded an fbx model from Mixamo, imported the fbx into blender and then exported to .babylon. When I load the model and begin a bone animation, the model distorts. Could someone tell me what I'm doing wrong?


            BABYLON.SceneLoader.ImportMesh("Akai", "scenes/", "skintest.babylon", this.scene, function (newMeshes, particleSystems, skeletons) {                newMeshes.forEach(s=> s.material = mat2);                newMeshes[0].rotation.x = -Math.PI / 2;                newMeshes[0].scaling.x = .2;                newMeshes[0].scaling.y = .2;                newMeshes[0].scaling.z = .2;                newMeshes[0].position.y = -20;                                that.scene.beginAnimation(newMeshes[0].skeleton, 0, 10, false, .1);            });




Link to post
Share on other sites

Hi jchristof - welcome to the babylon forum :)


Does the animation have a frame 0 in Blender**? If so try deleting it and then re-exporting your model.


The fbx import into Blender with animation has been under development - I'm not sure whether it is still perfected yet. So the issue maybe with Blender as opposed to BJS.


cheers, gryff :)


** or the first frame of the animation - check to see if it is the T-pose.

Link to post
Share on other sites

Blender shows that the animation fbx does not start in the t-pose. Mixamo can provide separate files for the t-pose and each animation. Is it possible to load the files in babylon.js and programatically use the animation fbx with the t-pose fbx? I'm looking for an alternative to resetting the pose in each separate animation file.


Link to post
Share on other sites

My first attempts at importing skinned animation over the past couple of days resulted in a distorted animated mesh.  I was asking for trouble because i was exporting skinned animation from Cinema4D via FBX to 3dsMax and then into .babylon format via the Max exporter.


The problem turned out to be the mesh object had been scaled down in c4d prior to skinning it.  I reset the scaling in c4d, reskinned and reexported over to Max and it ran fine in Babylon.  Anyway, the point is just, sometimes unnoticed mismatches like these that are handled fine by the original app can cause problems, and also impossible for a export plugin dev to diagnose :/  Also to add, the animation played back fine in max, and wasn't until exported to Babylon that the problem became obvious..

Link to post
Share on other sites

Just a quick update as I'm still investigating - 


I built the FbxExporter.exe against the Autodesk VS 2013 sdk - there are some warnings for me, but the project build without an error. (buildlog.txt)


FbxExporter.exe converts back_flip_to_uppercut.fbx => back_flip_to_uppercut.babylon file. The images for material are output in a .fbm directory

Now when I load back_flip_to_uppercut.babylon with ImportMesh, the model loads file with it's material. 

Animation starts immediately, even though I did not specify it to start.


Even if I load like this, the model animates without stopping


BABYLON.SceneLoader.ImportMesh("", "scenes/", "back_flip_to_uppercut.babylon", this.scene, function (newMeshes, particleSystems, skeletons) {                that.scene.stopAnimation(newMeshes[0]);}

Here is back_flip_to_uppercut.babylon up to the indices:



Link to post
Share on other sites

Ok, the problem about the truncation of the anim seems to be related to the fact that there are 2 animation takes in the fbx (and the exporter is somewhat buggy with these files : it uses the first take present in the file for getting timing info, and it takes the first take containing animations for each node to get the animation keys).


The first take in the file (Take 001), does not contain animation keys, but it has a 30 frames duration

The second take (mixamo.com), contains animation keys and is 175 frames long.


So the plugin think there is only 30 frames of animation (it gets that from the first take it finds), and extract only those 30 from the animation data.


As a quick workaround, you can try to import the fbx in 3DS max and reexport it with only 1 animation take (you can use FbxReview to check that).

In the same time, I will make a fix allowing to specify which animation take to export in the tool.



Link to post
Share on other sites

@Romanichel_2.0 - confirmed that this does seem to produce a full backflip animation. I ran the redist x64 console.


I'll look at this a bit closer later on to figure out what the Take 001 means in terms of why it's there etc. and educate myself more on the tech.


C:\Users\jon.martin\Downloads\babylon fbx tools x64>FbxExporter.exe back_flip_to
_uppercut.fbx . /animstack:mixamo.com
version : 2015.09.14
Usage : FbxExporter <path to fbx file> <outdir> [/fps:60|30|24] [/skipemptynodes
] [/animstack:"animstack name"]
Animation stacks :
[ ] Take 001(41 - 1000)
[X] mixamo.com(0 - 5833)
Nice work - thanks!
Link to post
Share on other sites
  • Solution

The 2 takes seem to suggest that the fbx comes from a merge of different assets:

- 1 asset contains the 3D mesh with its materials and its bindings to the skeletton

- 1 asset contains an animation to the same skeletton


It's a very common way to do for 3D artists and animators as it allows different meshes to be bound to the same skeletton and share the same set of animations.


In you file, the Take001 anim stack does not contains any animation key, and it shows the 3D model in T-pose (seems to come from the file containing the 3D mesh and skeleton binding info) and the mixamo.com anim stack contains the bones' animation keys.


If you take a look at the FbxRerouteSkeleton project, it allows you to do exactly this kind of merges, with an FBX file containing only skeleton animations, and others containing only static 3D meshes bound to the same skeleton.

Link to post
Share on other sites
  • 7 months later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...