Baked animation support

Hey guys,

as we know updating skeletal animation hierarchy takes big chunk of frame time, do you guys have plans to support baked animations in future?

Thanks.

1 Like

can you tell me more about that feature?

Hi,

let’s say for 30 frames Idle animation, The idea is to pre-calculate transformations for each bone for all its frames in an animations upfront, and use that data to animate the character hence cutting down this overhead from each game frame but ofc, file sizes will increase.

here’s some thread from unity forum(all engines supports this by the way) : http://answers.unity.com/answers/1355849/view.html

oh ok gotcha! This is totally in the acceptable realm :slight_smile:
The idea would be to avoid computing all the bone hierarchy but instead have a matrix ready for each bone for each frame, correct?

3 Likes

yup. that’s pretty much it. :slight_smile:

what do you think? will you guys add something like this?

not now but happy to consider. One thing is how to store the data? Is there existing file format?

1 Like

I think just storing the data per frame in an array would do it.

This would not be to hard to pull off, if I was not writing documents all day…

Would imagine a consideration is different playback rates and how to get your baked animation playing at the same rate across different clients after its been baked.

1 Like

I am not sure if GLTF supports it because GLTF is all about less sizes. :sweat_smile: But if it doesn’t than we can consider to have an intermediate cache maybe during game loading. Something like that, on positive side this will also give user control over cache size and other things. Just another alternative. But totally up to you guys. I liked babylon js so far. Nice work. :slight_smile:

1 Like

You could always import your gltf and then run it through the baking process we come up with at run time?

I am onboard 100% with baking stuff though.

hey, are you part of Babylon staff?

We are all Babylon staff in our own special way @Ankit_Singh :wink:

2 Likes

YES!

3 Likes

@Ankit_Singh: ok so as @Pryme8 it could be done upon loading the animation (like after loading a glTF file).

This is really interesting. Can you please create a feature request on the repo? That is something we could consider for next version (unless someone wants to tackle it before)

1 Like

I think you may be interested in Vertex Animation Textures.

3 Likes

Sure. I will do that.

So can I contribute to babylon js as well?

My channel has skeletal animation demos… (used opengl)

2 Likes

oh my gosh: YES!

3 Likes

Yes, sort of “recording” an animation by running through it once and pulling out the final world matrices seems like the way to do this. You might just take those values and write another animation object.

Having a member like isLocalMatrices = true might be added to animation class. Of course, for the recorded instance the value would instead be false. That knowledge would then have to be plumbed into the process.

As far as doing that in advance, and just loading it, you might make a JSON file.

Issues that I can foresee are:

  • data comes in different ways between .babylon & .glb formats. Not sure if both ways can be supported in the same way.
  • root bone rotation / translation would not work. You would have to move / rotate the mesh not the rootbone. Probably not a real issue, since it is not currently supported here, but doing both seems unlikely.
1 Like

@Pryme8 @JCPalmer want to collab and add this feature in babylon js? or are you guys going solo? I understand the math and how skeleton animation/blending/masking works but not familiar with how babylon manages animations. you guys seem very familiar with babylon.

Hi, have added a feature request.

1 Like