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

Gif image Import support in neos? #261

Open
Jazzneo opened this issue Jun 20, 2019 · 10 comments
Open

Gif image Import support in neos? #261

Jazzneo opened this issue Jun 20, 2019 · 10 comments
Labels
Enhancement New feature or request Low Priority Not that important, will be addressed later when reasonable

Comments

@Jazzneo
Copy link

Jazzneo commented Jun 20, 2019

Was wonder if possible add gif image support into Neos. nirvana want that Feature so upload gif in neos

@Casuallynoted
Copy link

I really like this. Animated gifs are awesome, maybe even a way for Neos to convert an animated gif to an mp4 and use the video player for it?

@Frooxius
Copy link
Collaborator

This would be very cool, but it requires a significant work. I might need to a day or two just on this feature (or more if there are more issues), so that makes it difficult to prioritize it over other things.

One problem is that GIF is a bit tricky, because it can be treated both as static texture or a video, but you don't know without actually decoding it (which is usually too late, because the decoding is determined by the type of the asset) so it would require some new pre-decode mechanism.

Another issue is that it requires writing a custom playback handler, which synchronizes decoding of individual frames at the right times and uploading to the GPU, with some decoder that can extract the frames (the FreeImage library we're using can do the frame extracting, but the rest needs to be written from scratch). There are performance implications with that as well.

I'd say that converting to MP4 or another video format is better solution for now, or using a sprite atlas and animating the UV's for short animations.

@Frooxius Frooxius added the Low Priority Not that important, will be addressed later when reasonable label Jul 27, 2019
@sirkitree sirkitree added the Enhancement New feature or request label Oct 27, 2019
@Banane9
Copy link

Banane9 commented Jun 16, 2021

For what it's worth, you can convert the gif you want to import to a sprite sheet / atlas and then import that as a texture and slap UVAtlasAnimator and TimeIntDriver components on it to play the animation.

https://ezgif.com/gif-to-sprite

@shadowpanther
Copy link
Contributor

Is there a way to implement automatically converting GIFs to spritesheets on import and setting UVAtlasAnimator and such?

@Frooxius
Copy link
Collaborator

There is, but I don't think it's a good idea. Some GIFs can have lots of frames, meaning it would result in a really huge spritesheet (you'd probably need multiple) and result in lots of VRAM usage. It effort is put forward to this, it's better for the actual playback than that.

GIFs also have multiple different modes, e.g. looping modes or looping from certain frame, as well as ways where previous frame is overdrawn and lots of other crazy stuff that's not representable with just UVAtlasAnimator either.

@shadowpanther
Copy link
Contributor

Ah, that's fair. Also I remember that every frame could have different duration, so playback with constant speed wouldn't cover every case.

@Banane9
Copy link

Banane9 commented Jun 16, 2021

Yea, gifs have surprisingly sophisticated animation options for being a decades old format.

The glitchy text I've got for the davali changed mask uses a 4k Atlas with 8x8 (64) frames for each animation, so often you can get away with just putting all the frames into one big texture. Most memes or such are less than a few seconds and low resolution, so are fairly easily convertible manually.

@dfgHiatus
Copy link

As a heads up, there is now a workaround for this issue: https://github.com/kawaiiamber/GifImporter

@astralchan
Copy link

astralchan commented Feb 2, 2023

Thought I might post some relevant information regarding all the tags of gif from System.Drawing.Imaging

0x5101 is the PropertyTagLoopCount. From what I understand, it could be no loop, loop once, twice, three times, or forever. I have it loop forever regardless of this value.

@astralchan
Copy link

Just thought I'd mention that the GifImporter mod has moved to https://git.astralchan.xyz/astral/GifImporter if anyone was still wondering about this issue / mod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Low Priority Not that important, will be addressed later when reasonable
Projects
None yet
Development

No branches or pull requests

8 participants