Jump to content

Animations export problems


Recommended Posts

Hi all!


I have one problem with export models with animation to babylon format. 

First, I have some models from mixamo in .dae format. I import one of that models into blender (2.76), and all working good. But skeleton has some transform: rotation on X 90 degree and scale. 
Then, I export this model to *.babylon format and load into my scene. Scale from skeleton and rotation didn't save, but animation worked good. 

After I wrote some code to fix scale and rotation:

unit.scaling = new BABYLON.Vector3(0.01, 0.01, 0.01)unit.rotation.x = 3 * Math.PI / 2;

Without animation model loaded fine, with correct size and rotation. But after animation started

scene.beginAnimation(skeletons[0], 0, 16, true, 0.3);

I have something wrong...




What I do wrong? =) 
Thanks in advance and sorry for my English. 


Link to comment
Share on other sites

Well kzerot I have got the animation behaving - see here.


But as you can see there are other issues - the normals are all over the place :o I suspect that it comes from the .dae import into Blender


I tried some simple fixes in Blender - but they did not work :(


I will post again with a detailed workflow for getting the animation working and more details on the normal issue as I look at it again over the next couple of days..


cheers, gryff :)

Link to comment
Share on other sites

Well kzerot, I took another more detailed look at your problem this morning, and while the normals are not an issue anymore, I have run into an interesting issue.


I created a file  "export_error2.blend". This is a simplification of your original file - I added a camera and a light, cleaned out the normal/specular texture stuff, just have the diffuse texture which I packed into the blend file and set to use the first UV map in the long list, and made the last frame of the animation 208. That was my starting point for the first two experiments below. You can get a zipped version of that the file here : startfile


All demos below use the same, very simple,  javascript and BJS v 2.3.


Experiment 1 : Using Blender 2.71 and Babylon Exporter v 1.8.0 from an XP computer and the following steps:


1. Select the armature and put it into the "Rest Position".
2. Now select the mesh(Kachujin) and then Alt+ P and chose "Clear and Keep Transformations" option.
3. With the mesh still selected hit the N key and note the rotation and scale of the mesh - same as the armature. (If you just used "Clear Parent" in 2, you get a huge mesh lying on its back.)
5. Apply rotation and scale to the mesh.
6. Now Select the mesh and then Shift Select the armature.
7. Then CTRL + P to parent the mesh to the armature again - use the "With Empty Groups option".
8. Put the armature back into "Pose Position"
8. Export to BJS as usual.


And here is the result : Kachujin in Action XP


The result seems to be fine - only issue seems to be the inside of the sleeve being transparent  - which can be fixed.


Experiment 2 : Using Blender 2.76 and Babylon Exporter v 3.0.6 from a Windows 7 computer using same steps as above:


And here is the result : Kachujin in Action Win7


Not a pretty sight :o. As far as I can tell the mesh is deforming properly with the animation but the scale and the position of the figure are strange. 


I saved the file I had modified in Blender 2.76 for the next experiment.


Experiment 3 : Using Blender 2.71 and Babylon Exporter v 1.8.0 on my XP computer to create a .babylon file from the blend file saved in 2:


I  opened the blend file saved in Experiment 2 in Blender 2.71 and just exported the figure again. No further mods of any kind.


Here is the result : Kachujin in Action Win7 to XP


The same as Experiment 1 - as far as I can tell.


So is the issue I am finding somehow a difference in the two exporters? Why am I getting the strange result in Experiment 2?



When I ran into the problem with Experiment 2, I started using the web console to check for issues. Firstly I checked the camera position and rotation - all give same result.


But I noticed this additional info in all of the above examples :

BJS - [14:12:54]: Unable to compile effect with current defines. Trying next fallback. babylon.2.3.js:3:12357BJS - [14:12:54]: Vertex shader:default babylon.2.3.js:3:12357BJS - [14:12:54]: Fragment shader:default babylon.2.3.js:3:12357BJS - [14:12:54]: Falling back to CPU skinning for Kachujin babylon.2.3.js:3:11987

Your armature has 65 bones - I normally work with around 40. Is this causing the issue and generating the above code?


Maybe people above my pay grade  can provide further information about what might be happening.


cheers, gryff :)



Link to comment
Share on other sites

I did not do much / anything between 1.8 & 3.0 in the armature department.  Unfortunately, there ARE multiple 1.8 versions.  A couple of people made changes without changing the version. KILL 'EM ALL!!  uh, sorry.


i remember this one guy made changes so mesh need not be child of armature in that time period.  Could look at repo diff history.  Another angle is to diff the .babylons.


I just completed my testing of specifying a lower max influencer for Make Human than required, and results were very good.  Hair looked good dropped to 1 from 5.  Proxy body still looked ok down to 4 from 7.  I am going to shelve trying pick which influencer get used when you restrict.  This will mean I can start to wrap up 4.0, after I add cross .blend.  I do not think trying to work with 3.x is worth it at this point.  Maybe revisit this Blend when in QA for 4.0.

Link to comment
Share on other sites

  • 2 weeks later...

I tried working with this start Blend.  Doing nothing to it in Exporter 4.0 gets the camera looking at the feet looking up, never bothered animating it, just used the sandbox.


Tried to reproduce the finish blend using the weekly update to Blender 2.76.  Used stack exchange to reset pose to rest. 'A' - 'ALT R' - 'ALT G' - 'ALT S'.  The camera is now in the position of at the feet.  The mesh is now laying on the ground.  I could not follow the rest of the steps.


I tried the 'ALT R' - 'ALT G' - 'ALT S', but just with the armature.  The same thing happens ( turns into a giant laying on its side), but the camera does not follow.  I turned the armature x 90 degrees & applied it,  animation played.  Did not get the camera in a great position to do an export, but the sandbox does not change all.  Think this is caching.  I made a TOB export, & the camera is a the right place, the animation is totally screwed up though.  I really need a finished .blend not starting.


Will delay 4.0 release.  If you can post that will be good.

Link to comment
Share on other sites

Ok, I looked closer at that stack exchange post. 


I used the Select armature pose from Outliner , then space and typed "Clear Pose Transforms" way to set pose to rest position. for 1 this time.


Then I did 2-5.  I skipped 6-8.  You no longer need to to this.  Exported to Javascript using version 4.0 of exporter.  Ran fine.


Will try with the .babylon exporter 4.0. If it works, will proceed.

Link to comment
Share on other sites

Works with 4.0 .js / .ts or .babylon exporter.  Gryff, Armature need not be parent of Mesh as of 3.0.  4.0 also optimizes verts.  Before positions, normals, uvs, uvs2 would all be 37827.  Here is what log says:

	processing begun of mesh:  Kachujin		processing begun of Standard material:  kachujin_MAT		Diffuse texture found"Texture"			Image texture found, type:  diffuseTexture, mapped using: "Kachujin-lib-UV0"		num positions      :  9236		num normals        :  9236		num uvs            :  18472		num uvs2           :  18472		num colors         :  0		num indices        :  37827		Skeleton stats:  			Total Influencers:  14625			Avg # of influencers per vertex:  1.5835			Highest # of influencers observed:  5, num vertices with this:  6			exported as 5 influencers			num skeletonWeights and skeletonIndices:  73888

I see that there are also 6 stray vertices with 5 influencers.  Forcing down to 4 would be a good idea, if there is no damage.  4 to 5 doubles the skeleton weights & indices.


Am now set to release.

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.

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