Jump to content

Exporter blender : multi animations bug


Pierre Glibert
 Share

Recommended Posts

Hello everybody,

We have a problem with Blender Exporter 4.6.1.

Let us explain to you :

We have two animations : one cube with skeleton and another with a standard animation.

In blender, after we export our scene with babylon exporter, it replaces all the animations by one.

In the babylon file, we have all animations that are merged one after another. For all meshes that contain animation, the exporter copy all the keys of all the animations in one animation.

Please find enclosed the file with source and video to show you this bug.

 

Thank you in advance for your help ;)

Letsbro studio team.

cubeAnimBug.zip

Link to comment
Share on other sites

Yep, Blender exporter supports multiple actions translated into BJS AnimationRanges.  I see range tags in .babylon file

"ranges":[{"name":"animArmatureCube1","from":0,"to":100},{"name":"animCube2","from":110,"to":210}]

Not a bug, a feature.  Call the animations on your skeleton, or non-armature mesh using:

armatureCube1.beginAnimation("animArmatureCube1", or "animCube2")

and

cube2.beginAnimation("animArmatureCube1", or "animCube2")

 

 

 

 

Link to comment
Share on other sites

hi @Deltakosh @JCPalmer,

Thank you for your quickly answer.

@JCPalmer : It's not really that the bug. Could you look in the first time at our video that shows the bug ?

In Blender, you can see 2 cubes : "armatureCube1" with an animation called "animArmatureCube1" and "cube2" with an animation called "animCube2".

You can see what append after the export : "animArmatureCube1" is replaced by "animCube2". So, the position of the cube "armatureCube1" has changed because it take the position of animation "animCube2".

Can you help us ?

Thanks.

Letsbro team. 

cubeAnimBug.zip

Link to comment
Share on other sites

I see, it looks like the armature animation is duplicated.  Even in your .babylon file cube2 is participating in both actions, as the values for rotation and position are not the same for frames (100 & 210).

Position, rotation, & scale properties are exported as the actual frames.  Skeletal animation is exported for every frame (baked).  As a diagnostic, I switched off baking for skeletons, line 49:

FRAME_BASED_ANIMATION = False # this is only able to be turned off by the TOB exporter right now

I get actual frames above 110, so something is getting recorded for the armatureCube1 skeleton for the animCube2 action.  Here is the relavent part of that .babylon:

"skeletons":[{"name":"armatureCube1","id":0,"dimensionsAtRest":[0,1,0],"bones":[
{"name":"Bone","index":0,"matrix":[1,0,0,0,0,0.591,0.8066,0,0,0.8066,-0.591,0,0,0,-1.5,1],"rest":[1,0,0,0,0,1,0,0,0,0,-1,0,0,0,1.5,1],"parentBoneIndex":-1,"length":1
,"animation":{"dataType":3,"framePerSecond":24,"keys":[
{"frame":0,"values":[1,0,0,0,0,1,0,0,0,0,-1,0,0,0,-1.5,1]},
{"frame":100,"values":[1,0,0,0,0,1,0,0,0,0,-1,0,0,0,-1.5,1]},
{"frame":111,"values":[1,0,0,0,0,1,0,0,0,0,-1,0,0,0,1.5,1]},
{"frame":210,"values":[1,0,0,0,0,1,0,0,0,0,-1,0,0,0,1.5,1]}],"loopBehavior":1,"name":"anim","property":"_matrix"}}]
,"ranges":[{"name":"animArmatureCube1","from":0,"to":100},{"name":"animCube2","from":110,"to":210}]}],

 

Link to comment
Share on other sites

You are right ! We have a link between animations.

In blender, we need to manage animations in "NLA editor". We must to create a new track per animation.

That works with several mesh animations but we have always a problem when we add an armature animation... Blender add automatically "animCube2" to "armatureCube1" after export ... 

We will search the solution and we will contact you when we will find it ;)

 

Link to comment
Share on other sites

 

We have no solution ...

We don't understand why the exporter change our Blender file...

We made you two screenshots :

- first before export :

before export.png

- and second after export :

after export.png

Is there somethings in exporter code that change something in Blender ?

@JCPalmer : Have you some skills in Blender ? If yes, could you try to do same think with our blender test and see if you are the same result please ?

thank you again,

Letsbro studio team.

 

 

Link to comment
Share on other sites

hi @gryff,

I saw, in a post, that you are an expert in blender animation.

Could you help me for this problem please ?

I have 2 animations. One on armature and one on mesh. 

After export, the animation change and i don't know why ...

I don't know if it's a bug or if I do something wrong :) .

There is an attached file with a short video that show my problem and my blender test.

Thank you for your help,

Letsbro studio team.

 

cubeAnimBug.zip

Link to comment
Share on other sites

@Letsbro studio Well I took a look at your files and video - and I thought, I've seen this before a few weeks back. I was using a scene with a rigged character (33 bones) and a simple animated cube. The export resulted in the character being in a very strange position :o and the animation of the cube adding to the animation range of the character. As a consequence of this addition the file size was increasing.

Now by chance, I was starting to test out a recent way of creating scenes - using "BABYLON.SceneLoader.Append" instead of "BABYLON.SceneLoader.Load" - as the latter has been deprecated. So I created two .blend files, one with the character and one with the animated cube, exported each file then used two separate Append statements. Using this approach I have created a simple set up that roughly duplicates your test scenes:

Two cubes

The white cube has the rig, the red one is just a simple animation. In both files animation are 1-100 frames - and no frames upto 200+. Take a look at the code in the file CreateScene.js - I've tried to give some clear comments about what is happening with each line of code.

I went a bit further and added a second mesh to use the simple animation - Suzanne:

Two cubes and Suzanne

In this latter case the red cube and Suzanne only have animation keys for rotation (location keys would move Suzanne to the location of the box). Both Suzanne and the cube are in the same.babylon file.

Now the problem really is not with the export of multiple animations as a rigged character may have walk, run, jump, idle etc and we want those ranges filled with a library of animations as the old method (before @JCPalmercame up with the idea of ranges) was to just manually build a single animation with all the different pieces (tedious). The problem is actually multiple animations on multiple objects - the animations end up being combined into a single range

Now for rigged objects there has been a recent development - copying animation ranges - here and here. And actually only copying specified parts of the animation range contained in an animation file. As someone on that thread put it "bleeding edge".

Object meshes with simple animations also have ranges - but I am not sure if they are copyable from one object to another.

cheers, gryff :)

Link to comment
Share on other sites

Multiple actions on armatures with multiple meshes which have it set as a modifier is already possible.  I do not what you are defining as an "animation", but at this level of detail the term is inadequate.

I saw you are doing something with that NLA Editor thing.  You say you need to manage "animations" with it.  No you don't, at least not with Babylon JS.  BJS does not work that way.  There is no equivalent to NLA in BJS, nor an implementation of this track thing you reference.  Stop using it would be my recommendation.

Link to comment
Share on other sites

  • 10 months later...

Hello everybody.

Same problem here with a model (not armatures needed) containing several moving parts (mainly different doors opening and fans spinning).

In the process of exportation the blender animation is changed. As a result we get a useless .babylon scene (as is not consistent with the intended animation) and our blender scene keyframes are modified (corrupted).

For your convenience, it can be reproduced using a very basic scene.

- Before exporting the scene:

OriginalScene.thumb.gif.72d441620db1262a9a0b8b0f90917790.gif

 

- After exporting, blender (shown) and .babylon scenes are both wrong.

AfterExportScene.thumb.gif.16f9eab28594533a66caa57a4803480a.gif

 

We are not using NLA at all.

Is this misbehaviour of the exporter going to be fixed?

Best regards.

 

P.S.

Blender 2.78

BJS Blender Exporter 5.2)

Link to comment
Share on other sites

@paleRider : I tried to explain this above - but Dropbox screwed up my examples with changes they made last September:(. So here is a new example without Dropbox.

The blender scene has two objects - a cube and a sphere - with each having an animation that moves  them from left to right separately (see attached image)

Undesired Merged Animations - the objects move on top of each other (condition A in image below)

Desired Animations - the objects each have their own animations (condition B in image below)

The difference is in how the animations are named. Note the "-" (hypen) in the name for the proper animations(B). The exporter need this - otherwise it combines the animations .

cheers, gryff :)

 

actions.png

Link to comment
Share on other sites

Thank you very much both (letsbrostudio and gryff) for your time.

About using 3DSMAX, our favorite 3D software here is Maya, as we were until the moment more focused on pre-rendered 3D. Now we are moving seriously to RT 3D also (on web, VR and RA projects), and as there's not a Maya exporter for BJS, we decided to choose Blender for this kind of tasks.

About the "trick" with the hypen, in the previous post explaining it I didn´t catch the sense. My fault.

I suppose the naming convention is then "MESH_NAME-Action" in any case.

Unfortunately, after doing that way I get the same bad results that before. (?)

Anyway, I was trying this days the new Blender Exporter 5.3 Beta. My problem with it was that it exports all the actions in the scene one after the other along a unique timeline (extending the ranges) so I needed to make numbers to resynchronize things. Miraculously applying your "hypen recipe" did the job, and I have now finally the animations side by side and with the proper frame ranges.

As a colofhon: "MESH_NAME-Action" action names + Blender Exporter 5.3 Beta is the way to go!!

Best regards.

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...