After spending a couple of days I’ve finally figured out how to bake VAT at the max FPS.
The DEMO: https://playground.babylonjs.com/#3NIXCL#688
On my laptop it requires 400-500ms to render ALL animation groups into the texture.
For previous code, it was > 25sec.
You can see the code here: GitHub - afrokick/bjs-vat-helpers
How it works
- Create a temporary scene to render VAT as fast as possible(manually call
scene.render
method) - Disable some stuff to gain more performance while rendering(like aggressive mode)
- You only need to have any mesh with skeleton to be able to render animations into texture. So you can have a simple version of you complex model(like only a hat mesh for Character). In my game I have
player_vat.gltf
for vat baking(simple mesh+skeleton+animations) andplayer.gltf
for rendering(all meshes + skeleton).
Thank you @Evgeni_Popov for your help with VATs. Now I understand it more deeply.
@oriongu You can use it in your MMO as well!
PS It would be nice to have it “out of the box” for babylonjs/core.