JSON Animations in Babylon

This is not exclusive to 3DS Max, but it is where I saw the option

In the 3DS Max Animations menu, there is an option to export a JSON of named keyframe animation ranges.

I would assume there is a way then to load those animations from a JSON file into Babylon on the fly, instead of having them all baked into the GLB, GLTF, or Babylon.

How does one go about doing this?

I don’t think we can load animations from a .json file: @Deltakosh or @Drigax will know for sure.

Yeah, I got curious why you can export a JSON from within the animation menu just because the buttons been staring at me for a long time now. But, I did not see any documentation on it. It looks like the JSON button exports animations groups, not frames.

In thinking back, I think I recall a playground that did use JSON loading, or at least JSON files in animation loading. I vaguely remember the Babylon Rabbit and its death and run animation loaded on the fly with GUI buttons. Though maybe I was hallucinating… I can’t find it now oddly, spent a few hours looking.

I will wait for more masters to weigh in. Thanks.

Maybe this PG will help - https://www.babylonjs-playground.com/#ONZNB#1
(still there is no separate json for animation, just serialzed mesh).
Also, have a look at this thread - Babylon~cinematics

That was a contribution that was added for Keyveo’s glTF pipeline via @elpie89. IIRC they had multiple scenes with similar animations, and needed a file that kept track of animation track frame timings. I think he can give a better explanation of the usecase than I can.

IIRC, Maya and 3ds Max don’t have a concept of animation groups, and instead if you had multiple animations for a given armature, you would animate them one after the other on the timeline.

Now imagine you have several hundred Max scenes and you want to make sure they all have the same animation group frame timings set to match your original scene’s to export properly.

(atleast that’s what I think its for)

If you want to only export animation data, there are other options for that, but I’m not too sure how useful this feature would be for you.

I’m not sure if this will be all that useful for you, because it’s not the actual animation data, just a small file that tells you where the groups are.

Crazy, I am actually facing down a very similar situation with several hundred animations needed and a rapidly expanding list of assets out of 3DS. For my use case, about half to 2/3rds of my needed animations can actually just be resampled ranges of a larger key framed animation that can be mixed and matched on the fly into animation groups retargeted to different assets.

This is all for a very primitive scripted cinematic action/animation system I have been building. But the best way to manage, sample, re target and dynamically build animations is something that has been making my head spin for a few weeks. I have built a few renditions that work, but nothing as elegantly simple to manage as I want. I tear apart and rebuild this animation component at least weekly :frowning:

I was playing with different methods of storing and sending ranges from a MySQL DB that drives my site, which is why I got curious about the exporter spitting out JSON. I am not a native web developer, but happily learning. JSON files seemed “friendly”, light and simple enough to send directly or from a DB query. The DB, which is working for everything else - is critical given the #'s of potential animations and slicing, dicing, and re targeting that happens. It would be impossible to manage otherwise. Given you can just mass highlight animations in Max and smack export to JSON, it seemed like the easiest way to bulk update animations without needing to re-export the entire asset or going through the DB line by line to update start stop positions every time you tweaked the keys. Given half the time my exported assets come out looking like abstract art, or missing entire pieces, when regular or skeletal animations are applied, when it works I rather not touch the primary asset :stuck_out_tongue:.

I remember seeing that rabbit example a few months ago and at least from memory it seemed like clean execution of dynamically loading retargeted animation ranges from JSON files. So, exactly what I need. But can’t find that PG anymore, and memory can play tricks, so may be I am miss remembering what was going on. Either way its driving me nuts not finding it again. Who thought hunting an invisible rabbit of Babylon would be so challenging.

General suggestions are always appreciated.