Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing animated gifs as textures #31

Open
JuanFdS opened this issue Nov 14, 2020 · 3 comments
Open

Allowing animated gifs as textures #31

JuanFdS opened this issue Nov 14, 2020 · 3 comments

Comments

@JuanFdS
Copy link
Contributor

JuanFdS commented Nov 14, 2020

Right now gifs can be uploaded as textures.

However, they aren't animated and instead get frozen at some frame, it'd be nice to have them animated.

Recording of usage of The Force. An animated gif displaying a cartoon rock is uploaded and used in the shader to show that the image rendered is frozen in a frame instead of being animated.

@JuanFdS
Copy link
Contributor Author

JuanFdS commented Mar 14, 2021

Hi! @shawnlawson , how are you?

I'm working on a possible implementation for this. I have 2 ideas of how it could be done:

  • Split the gif into its frames, load all images and in each paint() calculate the correct image to display and update it with texImage2D(...).
  • Convert the gif into a video, and then use the video since texImage2D supports video elements.

I'm already working on the first one locally and after hardcoding a lot of stuff (I already have the frames + know their duration + changed the code in the nyan cat texture to load this instead) was able to get something working
test

However, in order to get any of the 2 options done I think we'd need to add a dependency to split the gif into frames or turn it into a video. And I think I'll need some help understanding how to add that to this project :P

For example, let's say I wanted to add this dependency to split the gif into frames:
https://github.com/matt-way/gifuct-js
how should I do it? 🤔

@shawnlawson
Copy link
Owner

Oh, I see, hmmm. I suppose if the dependency can be built into an include-able file that would work. I can work on that, but not for a couple weeks. Looks pretty awesome though!

@shawnlawson
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants