gryff Posted May 9, 2014 Share Posted May 9, 2014 After the "Blue Lady" which was a large babylon file due mainly to the number of bones and the number of frames in the animation, I have been looking at how I might be able control the impact of animations on file size. So I have created a simple book animation - open and close. It has three bones - only two of which are actually animated - and I created 5 key frames over a 240 frame period. So this leads to the first two questions: 1. Even though there are only 5 key frames the exporter includes values for all 240 frames. Is it not possible to interpolate between key frames within the babylon framework? 2. The master bone - which is not animated is included in the babylon file - 240 frames values where nothing happens to that bone. Is there a way to indicate that rather than produce file bloat ? Here is part of my current babylon file:{"name":"book spine","index":1,"matrix":[0.0008,0.0000,-1.0000,0.0000,0.0007,1.0000,0.0000,0.0000,1.0000,-0.0007,0.0008,0.0000,0.0000,0.8161,-0.0000,1.0000],"parentBoneIndex":0,"animation": {"dataType":3,"framePerSecond":30,"keys":[{"frame":1,"values":[0.0008,0.0000,-1.0000,0.0000,0.0007,1.0000,0.0000,0.0000,1.0000,-0.0007,0.0008,0.0000,0.0000,0.8161,-0.0000,1.0000]}Frame 1 for the "book spine" bone - 16 "values" Appended below is an image of my Blender "Action Editor". Note the two bones that are being animated. Each one has 7 invididual values - w,y,z for "Location" and w,x,y,z for "Quaternion Rotation". How do 7 values in Blender end up as 16 values in babylon? Hopes questions don't seem stupid cheers, gryff Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 9, 2014 Share Posted May 9, 2014 Quaternions/positions are exported as matrices for bones' animations (more convenient for babylon.js) BTW, the exporter for Blender is a bit lazy and does not try to optimize output size at all. I'm looking for help on this topic clearly:) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 10, 2014 Share Posted May 10, 2014 Hey Gryff, can you try this one:http://www.babylonjs.com/forumPics/io_export_babylon.zip I tried a more "clever" way of exporting bones animations Quote Link to comment Share on other sites More sharing options...
gryff Posted May 10, 2014 Author Share Posted May 10, 2014 I'm looking for help on this topic clearly:)can you try this one: Sure. Will give it a go tomorrow. Anything to help reduce the babylon file size. cheers, gryff PS I see you are online at 9.40 EST(my time) - must be late in France. Do you ever sleep? g Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 10, 2014 Share Posted May 10, 2014 I live in Seattle:) Quote Link to comment Share on other sites More sharing options...
gryff Posted May 10, 2014 Author Share Posted May 10, 2014 Ok DK, I tried the new exporter and it reduced the file size by 40% for my little test set up - unfortunately all I get is a white canvas when I try to view a scene with the newly exported babylon file This is the code I am using to load :BABYLON.SceneLoader.Load("", "newbook4_4a1.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { console.log("ready");...});Here is what I get in the web console:GET http://127.0.0.1/webgl/site6/ [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/hand.js [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/babylon.1.12-beta.js [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/howler.js [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/site6/newbook4_4a1.babylon.manifest [HTTP/1.1 404 Not Found 0ms]GET http://127.0.0.1/webgl/site6/newbook4_4a1.babylon [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/site6/book_open.mp3 [HTTP/1.1 304 Not Modified 0ms]"Valid manifest file not found. Scene & textures will be loaded directly from the web server." babylon.1.12-beta.js:8GET http://127.0.0.1/webgl/site6/book_new1_anim1c_text1x1024%20copy.jpg [HTTP/1.1 304 Not Modified 0ms]If I change the babylon file to "newbook4_4a.babylon" - created with the old exporter - and view that it shows properly. Here is the web console output for the old file:GET http://127.0.0.1/webgl/site6/ [HTTP/1.1 200 OK 0ms]GET http://127.0.0.1/webgl/hand.js [HTTP/1.1 304 Not Modified 15ms]GET http://127.0.0.1/webgl/babylon.1.12-beta.js [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/howler.js [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/site6/newbook4_4a.babylon.manifest [HTTP/1.1 404 Not Found 0ms]GET http://127.0.0.1/webgl/site6/newbook4_4a.babylon [HTTP/1.1 304 Not Modified 0ms]GET http://127.0.0.1/webgl/site6/book_open.mp3 [HTTP/1.1 304 Not Modified 0ms]"Valid manifest file not found. Scene & textures will be loaded directly from the web server." babylon.1.12-beta.js:8GET http://127.0.0.1/webgl/site6/book_new1_anim1c_text1x1024_old13.jpg [HTTP/1.1 304 Not Modified 0ms]"ready" site6:104Note it prints "ready" in the web console - the first instruction in "newScene.executeWhenReady". - is this where it breaks down with the new exporter? I have tried it with babylon.js 1.9.0, babylon.1.11.js and babylon.1.12-beta.js I am using Firefox 29.0.1 and EasyPHP as my server. Looks like there could be substantial savings in file size if it can be made to work cheers, gryff Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 10, 2014 Share Posted May 10, 2014 I think I had a bug. Could you try again? I uploaded a new version Quote Link to comment Share on other sites More sharing options...
gryff Posted May 10, 2014 Author Share Posted May 10, 2014 Seems to work fine now DK. New file size is 58% of file produced with the old exporter Will start a new thread with viewable examples as I use another feature of babylon.js which has not recieved a lot of attention. Looking quickly at the babylon file from the new exporter, it really seems to deal with with my second question above - the bone that is not animated. from the original old file:"skeletons":[{"name":"the_book","id":0,"bones":[{"name":"book base","index":0,"matrix":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000],"parentBoneIndex":-1,"animation": {"dataType":3,"framePerSecond":30,"keys":[{"frame":1,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]},{"frame":2,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]},{"frame":3,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]},{"frame":4,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]},.... data for all the remaing 235 frames{"frame":240,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]}],The new exporter reduces that to:"skeletons":[{"name":"the_book","id":0,"bones":[{"name":"book base","index":0,"matrix":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000],"parentBoneIndex":-1,"animation": {"dataType":3,"framePerSecond":30,"keys":[{"frame":1,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]},{"frame":240,"values":[-0.0007,1.0000,0.0008,0.0000,-1.0000,-0.0007,-0.0000,0.0000,-0.0000,0.0008,-1.0000,0.0000,0.8471,0.0010,-0.0000,1.0000]}],An obvious improvement cheers, gryff Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 10, 2014 Share Posted May 10, 2014 Cool:) Quote Link to comment Share on other sites More sharing options...
gryff Posted May 10, 2014 Author Share Posted May 10, 2014 I also notice that the exporter produces for the camera "rotation":[0.7854,-0.0000,0.0000] instead of "target":[0.0000,0.0,0.0], (values for my files). Any other changes to the way data is handled? and what version of babylon.js should be used 1.11 or the 1.12 beta? I also notice from the lights thread that : Babylon.js 1.12 will introduce range for lights: This will be use to attenuate lights over distance. Looks like another big improvement, though I'm not sure "range" and "attenuation" are the same thing. cheers, gryff Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 11, 2014 Share Posted May 11, 2014 The light will attenuate linearly along the range For camera I do not change anything (It was already like this) you could use this exporter with bjs 1.11 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.