# Baked animation support

**URL:** <https://forum.babylonjs.com/t/baked-animation-support/14161>\
**Category:** Feature requests\
**Created:** [September 14, 2020, 2:48pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161 "2020-09-14T14:48:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 14, 2020, 2:48pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/1 "2020-09-14T14:48:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 14, 2020, 3:07pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/2 "2020-09-14T15:07:41Z")

</div>

can you tell me more about that feature?

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 14, 2020, 3:13pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/3 "2020-09-14T15:13:44Z")

</div>

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](http://answers.unity.com/answers/1355849/view.html)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 14, 2020, 3:29pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/4 "2020-09-14T15:29:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 14, 2020, 3:44pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/5 "2020-09-14T15:44:40Z")

</div>

yup. that’s pretty much it. 🙂

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 14, 2020, 3:51pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/6 "2020-09-14T15:51:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [September 14, 2020, 4:04pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/7 "2020-09-14T16:04:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 14, 2020, 4:06pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/8 "2020-09-14T16:06:49Z")

</div>

I am not sure if GLTF supports it because GLTF is all about less sizes. 😅 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. 🙂

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [September 14, 2020, 4:07pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/9 "2020-09-14T16:07:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 14, 2020, 4:12pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/10 "2020-09-14T16:12:52Z")

</div>

hey, are you part of Babylon staff?

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [September 14, 2020, 4:16pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/11 "2020-09-14T16:16:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 14, 2020, 4:17pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/12 "2020-09-14T16:17:47Z")

</div>

> [@Pryme8](#):
>
> We are all Babylon staff in our own special way

YES!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 14, 2020, 4:19pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/13 "2020-09-14T16:19:03Z")

</div>

@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)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [September 14, 2020, 4:24pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/14 "2020-09-14T16:24:56Z")

</div>

I think you may be interested in [Vertex Animation Textures](https://forum.babylonjs.com/t/vertex-animation-textures/6325/10).

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh1/32/10763_2.png) [@Ankit\_Singh1](https://forum.babylonjs.com/u/Ankit_Singh1)\
**Post date:** [September 14, 2020, 4:29pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/15 "2020-09-14T16:29:55Z")

</div>

Sure. I will do that.

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh1/32/10763_2.png) [@Ankit\_Singh1](https://forum.babylonjs.com/u/Ankit_Singh1)\
**Post date:** [September 14, 2020, 4:34pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/16 "2020-09-14T16:34:35Z")

</div>

So can I contribute to babylon js as well?

My channel has skeletal animation demos… (used opengl)

> **[Shady Coder](https://www.youtube.com/channel/UCNY28B-PqwRm60SoXGzAdKw)**

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 14, 2020, 4:41pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/17 "2020-09-14T16:41:01Z")

</div>

oh my gosh: YES!

> **[Start Contributing to Babylon.js - Babylon.js Documentation](https://doc.babylonjs.com/how_to/how_to_start)**

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [September 14, 2020, 5:09pm UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/18 "2020-09-14T17:09:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 15, 2020, 11:20am UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/19 "2020-09-15T11:20:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ankit_singh/32/9743_2.png) [@Ankit\_Singh](https://forum.babylonjs.com/u/Ankit_Singh)\
**Post date:** [September 15, 2020, 11:35am UTC](https://forum.babylonjs.com/t/baked-animation-support/14161/20 "2020-09-15T11:35:27Z")

</div>

Hi, have added a feature request.

> <https://github.com/BabylonJS/Babylon.js/issues/8966>
>
> Hey, It turns out skeletal animation takes big chunk of time from every frame since all transformations for each bone has...

[Next page](https://forum.babylonjs.com/t/baked-animation-support/14161.md?page=2)
