Jump to content

Load Animations at runtime


hen
 Share

Recommended Posts

Hi,

i am actually thinking about how to load animations at runtime.

Reason is that our project includes almost 3000 unique animation takes (7 years of hard work :) ).
That includes overrides of walk/run/idle/jump animations, actions (dance, etc) and gestures such as sit or laydown wich we need to bound to mesh objects.

The overall file size is of course far too large to preload and must be somehow loaded and triggered at runtime on demand.

I couldnt find anything about this in the docs.
Maybe someone could give me a hint?

 

Link to comment
Share on other sites

@hen

You can make a global assets object; e.g;

var assets = {};
    assets.characters = [];
    assets.animations = [];
    assets.buildings = [];
    assets.etc..

pre-load what you need at start up and then you can load the on-the-go stuff as needed via the sceneloader.importMesh or obj loader extension (whatever file extension you use).

the following example uses a id of 50, folder structure "assets/animations/", (animation id).babylon file structure and assumes that the animation is applied to a skeleton found in the .babylon file.

so basic use;

var id = 50;

if(!assets.animations[id]){
	BABYLON.SceneLoader.ImportMesh("", "assets/animations/", id+".babylon", scene, function (newMeshes, particles, skeletons)
	{
		assets.animations[id] = skeletons;
		
		//loaded
	});
  } else //already loaded
  

Disclaimer: i have never tried only loading a single skeleton or animation from a babylon file. :P

Side-Note: this may cause temporary performance issues for the client while the animation is loading.

Link to comment
Share on other sites

Hi @hen : You might want to take a look at this thread

Unfortunately the playgrounds don't work anymore as I think @ozRocker has deleted the character and animations from his server.

But if you look at the code you will see character mesh/rig  and the animations are derived from different .babylon files.

I think Blender was used to create the files - not sure how you would di it in 3DMax.

cheers, gryff :)

 

Link to comment
Share on other sites

@gryff

Thanks! 

I can see how that works.
Just this will not work with our project where i need to switch fast and smoothly from one take to the other and interpolate between the takes by weight.

With this project i am really struggling with everything that is related to bones :(
Having bones and animations linked together in Babylon is really a big problem when it comes to character customizing.
Like i am not able to scale bones for shape editing and there is no property for animation takes.

Babylon is great and its opensource so i really dont want to complain.
But i think i must roll back now to the previous lib i used to get things back to work.

Link to comment
Share on other sites

On 06/10/2016 at 8:04 AM, hen said:

@gryff

Thanks! 

I can see how that works.
Just this will not work with our project where i need to switch fast and smoothly from one take to the other and interpolate between the takes by weight.

With this project i am really struggling with everything that is related to bones :(
Having bones and animations linked together in Babylon is really a big problem when it comes to character customizing.
Like i am not able to scale bones for shape editing and there is no property for animation takes.

Babylon is great and its opensource so i really dont want to complain.
But i think i must roll back now to the previous lib i used to get things back to work.

The Babylon.js community can solve your problems related to bones. Right now they would be working on the 1,000 other improvements and extra features people have been asking for.  The whole framework is a group effort and a constant work-in-progress so if you need something specific to your needs, be prepared to put some time into it to help them get it done.  You don't have to be a top developer, just contribute by analysing the problems and experimenting with the solutions that people provide.

Link to comment
Share on other sites

On 8.10.2016 at 8:54 AM, ozRocker said:

The Babylon.js community can solve your problems related to bones. Right now they would be working on the 1,000 other improvements and extra features people have been asking for.  The whole framework is a group effort and a constant work-in-progress so if you need something specific to your needs, be prepared to put some time into it to help them get it done.  You don't have to be a top developer, just contribute by analysing the problems and experimenting with the solutions that people provide.

Dont get me wrong, i am not asking for someone to solve my problem :)

Question was more about if the problem can be solved with how the skeleton works right now.
At the end it wasnt a big deal to find a solution for the problem i originally asked for in this thread, after deltakosh pointed me to some functionality that i did not find in the docs.

You know, the babylon skeleton is in fact kind of different to skeletons in most other engines.
It is extemly tricky for us to write up custom conversion tools, or to solve the still open bone scaling/morph problem.

However, we can close this thread, since the original topic is solved.

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