sebavan/BabylonjsAnimatedGifSample

Can this support Gifs with transperancy?

Closed this issue · 5 comments

Thanks so much for releasing animatedGifTexture this is precisely what I need!

I'm sorta new to 3D stuff, so I'm not sure if this is a simple thing. I got it working, but my gif has a trail of all the previous frames. Is there an easy way to clear those frames?

Screen Shot 2020-05-22 at 3 35 30 PM

This is strange, it looks like there is no clear happening on your scene. I bet it is a transparent gif ?

Also maybe you could point me to your repo or code ??? so that I could have a deeper look ?

Thanks for helping. I didn't really change anything from this sample project. Only switched the the assets. You can see the change I made and also grab the GIF I'm trying to use here:

https://github.com/kevando/BabylonjsAnimatedGifSample/commit/f0d15655b9e75b61900566b393150b939dd909db

As you are using a transparent texture, you should try:

    // Clear
    engine.clear({ r: 0, g: 0, b: 0, a: 1 }, true, false, false);

just before customFilter.render in app.ts

This will ensure you are clearing the canvas before drawing back in.

Unfortunately adding engine.clear didnt resolve my issue. Same issue with other transparent gifs I found on giphy.

Is there anything else I can try changing? You did a great job commenting and tried making changes with no success. Would it make sense to use dispose here? And if so, when would I call it?