Animated Gifs in Babylon

In case you wonder how to use animated gifs in babylon, please have a read at:

Hope you ll enjoy it.

If it shows a lot of traction, we ll make it an official texture :slight_smile:



Wouldn’t it be possible to convert the gif to an animated sprite sheet? Don’t know if there would be some advantages to do se, though.

Note: I think you linked a wrong PG in your blog post => Babylon.js Playground

Main issue is the sprite sheet needs different size per sprites (each frame has a different size this is crazy) so would need to pack weirdly to save space … and would go over ios max size.

The best would be to do the color lookup for each texture and use only a r texture :slight_smile: per frame so we could save lot more memory but the code was getting dirty so I kept more demo focused :wink:

Didn’t know that an animated gif could have frames of different sizes!

Me neither but basically all frames are tiny patches to stick on the previous one with alpha test for the moving part. It saves lots of space but is annoying as hell :slight_smile:

1 Like

Couldn’t a procedural texture handle this as well instead of a whole effect wrapper?

It should but was a bit bigger in dependencies. It will eventually become one if the community would like to use it :slight_smile:

1 Like

In cryptovoxels we spritesheet the gifs, the main problem is keeping the spritesheet at a reasonable size means we have to crush the resolution quite badly.

We’re going to use AnimatedGifTexture when a user zooms in on a .gif to display the high res version.

Great work thanks @sebavan.


Awesome work @sebavan.

1 Like