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);            });

 

post-16376-0-80513000-1442024343_thumb.j

skintest.log.txt

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.

post-16376-0-86999800-1442064257_thumb.j

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:

{"activeCameraID":"defaultcamera","ambientColor":[0,0,0],"autoClear":true,"cameras":[{"animations":[],"applyGravity":false,"autoAnimate":false,"autoAnimateFrom":0,"autoAnimateLoop":false,"autoAnimateTo":0,"checkCollisions":false,"ellipsoid":[0.20000000298023224,0.89999997615814209,0.20000000298023224],"fov":0.85759997367858887,"id":"defaultcamera","inertia":0.89999997615814209,"maxZ":2010.053466796875,"minZ":4.0201067924499512,"name":"defaultcamera","position":[-0.025035858154296875,99.823860168457031,-402.01068115234375],"rotation":[0,0,0],"rotationQuaternion":[0,0,0,1],"speed":40.301033020019531,"target":[-0.025035858154296875,99.823860168457031,-0.99967765808105469],"type":""}],"clearColor":[0.20000000298023224,0.20000000298023224,0.30000001192092896],"fogColor":[0,0,0],"fogDensity":0,"fogEnd":0,"fogMode":0,"fogStart":0,"gravity":[0,0,-0.89999997615814209],"lights":[{"angle":0,"animations":[],"autoAnimate":false,"autoAnimateFrom":0,"autoAnimateLoop":false,"autoAnimateTo":0,"diffuse":[1,1,1],"direction":[0,0,0],"excludedMeshesIds":[],"exponent":0,"groundColor":[0,0,0],"id":"default_light","includedOnlyMeshesIds":[],"intensity":1,"name":"default_light","parentId":"defaultcamera","position":[0,0,0],"range":3.4028234663852886e+038,"specular":[1,1,1],"type":0}],"materials":[{"alpha":1,"ambient":[0,0,0],"backFaceCulling":true,"bumpTexture":{"animations":[],"coordinatesIndex":0,"coordinatesMode":0,"getAlphaFromRGB":false,"hasAlpha":false,"isCube":false,"isRenderTarget":false,"level":1,"name":"back_flip_to_uppercut.fbm/akai_normal.png","uAng":0,"uOffset":0,"uScale":1,"vAng":0,"vOffset":0,"vScale":1,"wAng":0,"wrapU":true,"wrapV":true},"diffuse":[1,1,1],"diffuseTexture":{"animations":[],"coordinatesIndex":0,"coordinatesMode":0,"getAlphaFromRGB":false,"hasAlpha":false,"isCube":false,"isRenderTarget":false,"level":1,"name":"back_flip_to_uppercut.fbm/akai_diffuse.png","uAng":0,"uOffset":0,"uScale":1,"vAng":0,"vOffset":0,"vScale":1,"wAng":0,"wrapU":true,"wrapV":true},"emissive":[0,0,0],"id":"175","name":"Akai_MAT","specular":[0.20000000298023224,0.20000000298023224,0.20000000298023224],"specularPower":60,"wireframe":false}],"meshes":[{"alphaIndex":0,"animations":[],"applyFog":false,"autoAnimate":false,"autoAnimateFrom":0,"autoAnimateLoop":false,"autoAnimateTo":0,"billboardMode":0,"checkCollision":false,"hasVertexAlpha":false,"id":"15_RootNode","infiniteDistance":false,"instances":[],"isEnabled":true,"isVisible":true,"name":"15_RootNode","pickable":true,"position":[0,0,-0],"receiveShadows":false,"rotationQuaternion":[-0,-0,0,1],"scaling":[1,1,1],"showBoundingBox":false,"showSubMeshesBoundingBox":false,"skeletonId":-1,"subMeshes":[],"visibility":1},{"alphaIndex":0,"animations":[],"applyFog":false,"autoAnimate":true,"autoAnimateFrom":0,"autoAnimateLoop":true,"autoAnimateTo":24,"billboardMode":0,"checkCollision":false,"hasVertexAlpha":false,"id":"174_Akai","indices":

buildlog.txt

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.

 

Simon

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.

Guest
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.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...