# Baked texture animation issues + PG

**URL:** <https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181>\
**Category:** Questions\
**Created:** [October 25, 2023, 8:26am UTC](https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181 "2023-10-25T08:26:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![glad](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@glad](https://forum.babylonjs.com/u/glad)\
**Post date:** [October 25, 2023, 8:26am UTC](https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181/1 "2023-10-25T08:26:16Z")

</div>

Hi,

I experience some issues in the workflow of VAT.

First, the PG dealing with the file preparation  
[https://playground.babylonjs.com/#CP2RN9#124](https://playground.babylonjs.com/#CP2RN9#124)

Second the PG dealing with file loading  
[https://playground.babylonjs.com/#CP2RN9#125](https://playground.babylonjs.com/#CP2RN9#125)

for some reasons, I can’t generate a file on the PG (it blocks at step “TWO”, but locally, it works, so let’s move on).  
The second PG has the resulting vertexJSON and has issues loading it because “is not valid JSON”

Is it the base64 encoding messing here ?

The animation will give a false sense of success because it will bypass the vertex texture and run fine.

Any help?

---

<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:** [October 25, 2023, 10:02am UTC](https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181/2 "2023-10-25T10:02:57Z")

</div>

For your first PG, you should not do `await baker.bakeVertexData(animationRanges)` but `baker.bakeVertexData(animationRanges).then(...)` because you will suspend the engine render loop with the former. The problem is that we need the scene to be rendered to make the animations run (the baker relies on `AnimationGroup.onEndObservable`) - see how it is done in the [doc](https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations).

In your second PG, you should `await response.json();` as `response.json();` returns a promise. Also, `loadBakedVertexDataFromJSON` expects a string. As you already have the right json object, you can use `loadBakedVertexDataFromObject` instead:

> **[Babylon.js Playground](https://playground.babylonjs.com/#CP2RN9%23127)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![glad](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@glad](https://forum.babylonjs.com/u/glad)\
**Post date:** [October 25, 2023, 10:32am UTC](https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181/3 "2023-10-25T10:32:10Z")

</div>

Thanks,

all the errors have been corrected, but now, my model still isn’t animated, just like in your PG.  
Is it an issue with the model in itself?

If you comment the VAT section, it is animated just fine.

---

<div class="post-metadata">

**Author:** ![glad](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@glad](https://forum.babylonjs.com/u/glad)\
**Post date:** [October 25, 2023, 11:41am UTC](https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181/4 "2023-10-25T11:41:11Z")

</div>

looks ok now, will dig to confirm.  
[https://playground.babylonjs.com/#CP2RN9#135](https://playground.babylonjs.com/#CP2RN9#135)  
thanks!!

---

<div class="post-metadata">

**Author:** ![glad](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@glad](https://forum.babylonjs.com/u/glad)\
**Post date:** [October 25, 2023, 11:48am UTC](https://forum.babylonjs.com/t/baked-texture-animation-issues-pg/45181/5 "2023-10-25T11:48:10Z")

</div>

Confirmed, it works, Thanks Evgeni, thanks a lot for your help!
