Support for APNG animated image format?

Moderator: GZDoom Developers

venividivici
Posts: 37
Joined: Sun Feb 27, 2022 6:45 pm

Support for APNG animated image format?

Post by venividivici »

http://littlesvr.ca/apng/gif_apng_webp.html

Same, same, but different, but still same PNG. No need to implement MP4 to have a video format when there is APNG minus the aduio that OGG or MP3 could be played at same time as APNG goes through sequence of images. Another possible benefit perhaps are reduced draw calls by calling single file instead of 3 or more for sprite animations as an example.
User avatar
nova++
Posts: 177
Joined: Sat Sep 04, 2021 3:13 am

Re: Support for APNG animated image format?

Post by nova++ »

I haven't seen an APNG in years. I thought it never really caught on and then pretty much died.
venividivici
Posts: 37
Joined: Sun Feb 27, 2022 6:45 pm

Re: Support for APNG animated image format?

Post by venividivici »

Pretty much all web browsers support APNG format.
User avatar
kevansevans
Spotlight Team
Posts: 420
Joined: Tue Oct 05, 2010 12:04 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Support for APNG animated image format?

Post by kevansevans »

This begs the question as to what advantage it would give over the current method. The regular .png is already supported, and making them animate in engine is done through Decorate/ZScript for actors, and the TEXTURES lump for textures. Probably most useful for inferring textures only, as getting them to work with actors would involve a tool that can correctly manipulate a .apng metadata, where already, you just name the file what frame you want.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Support for APNG animated image format?

Post by Enjay »

venividivici wrote:Pretty much all web browsers support APNG format.
True, but graphics editing programs that support them properly are less common and if people are going to use them, they need to be able to make/edit/save them.
venividivici
Posts: 37
Joined: Sun Feb 27, 2022 6:45 pm

Re: Support for APNG animated image format?

Post by venividivici »

kevansevans wrote:This begs the question as to what advantage it would give over the current method. The regular .png is already supported, and making them animate in engine is done through Decorate/ZScript for actors, and the TEXTURES lump for textures. Probably most useful for inferring textures only, as getting them to work with actors would involve a tool that can correctly manipulate a .apng metadata, where already, you just name the file what frame you want.
I am a complete layman so I am just going to explain my suggestion.

It is inspired by what I suggested for a game project that used RPG MAKER MV when I proposed for APNG format to be used, it resulted in far easier implementation of cut-in animation and less impact on performance when those show up.

This is aimed at animation and from video that explained the behavior of AI thus I am wondering if APNG is applicable.

https://www.youtube.com/watch?v=f3O9P9x1eCE

Because from what I can understand each frame of animation is one line of code / script thus for each one there is 1 image for example in PNG format hence I am wondering if its possible to condense such with use of APNG image format.
Enjay wrote:True, but graphics editing programs that support them properly are less common and if people are going to use them, they need to be able to make/edit/save them.
GIMP has a plugin that supports APNG and there are dedicated programs that one could select PNG images, set delay between frames along too compression through ZIP format if one wants to apply such.

Each image from APNG image format can be extracted individually as after all each image in APNG is PNG. APNG is animated format of PNG.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Support for APNG animated image format?

Post by wildweasel »

This, if anything, sounds like way more of a pain to work with than simply defining the states and durations like is already done in GZDoom, without the benefit that frames can be reused for arbitrary purposes, like randomized animations or things that need to sync to in game events.

I can only really think that this would be of any use for things like repeating texture animations, logistically speaking, because I definitely wouldn't want to use it for cutscenes.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Support for APNG animated image format?

Post by Enjay »

venividivici wrote:
Enjay wrote:True, but graphics editing programs that support them properly are less common and if people are going to use them, they need to be able to make/edit/save them.
GIMP has a plugin that supports APNG and there are dedicated programs that one could select PNG images, set delay between frames along too compression through ZIP format if one wants to apply such.

Each image from APNG image format can be extracted individually as after all each image in APNG is PNG. APNG is animated format of PNG.
That's kind of what I meant: gimp supports it, but only via a plugin (and, honestly, gimp's interface is awful IMO, right up there with Blender except that gimp is inherently a simpler program, so is less confusing), and you mention that several other programs exist but they sound like specific apng editing tools (and I'm going to guess that their bespoke nature also means they are a bit quirky) versus, "as long a you use any graphics program made in the last 12 years or so, it will support apng".
venividivici
Posts: 37
Joined: Sun Feb 27, 2022 6:45 pm

Re: Support for APNG animated image format?

Post by venividivici »

wildweasel wrote:This, if anything, sounds like way more of a pain to work with than simply defining the states and durations like is already done in GZDoom, without the benefit that frames can be reused for arbitrary purposes, like randomized animations or things that need to sync to in game events.

I can only really think that this would be of any use for things like repeating texture animations, logistically speaking, because I definitely wouldn't want to use it for cutscenes.
Its up to people to weigh in benefit and trade off, what is already done in GZDoom has its own trade off.

For each frame of animation there is a line of code / script, there are mods that have smooth first person animations that have a dozen or more frames hence benefit for those would be greater by having 1 line instead of 12 lines of code.

If for example you have 30 enemies on screen going towards you and shooting at you, each animation having 3 frames thus 3 draw calls then that is 90 lines of code that can be reduced to 30.

When I refer to cutscenes, I mean for pre-rendered cutscenes like Duke Nukem 3D and Shadow Warrior 1997 as an example for APNG also being able to used for such instead of MP4 or WebM being implemented.
Enjay wrote:
That's kind of what I meant: gimp supports it, but only via a plugin (and, honestly, gimp's interface is awful IMO, right up there with Blender except that gimp is inherently a simpler program, so is less confusing), and you mention that several other programs exist but they sound like specific apng editing tools (and I'm going to guess that their bespoke nature also means they are a bit quirky) versus, "as long a you use any graphics program made in the last 12 years or so, it will support apng".
I don't find anything quirky about dedicated and simple tools for making an APNG such as import PNG images in order you want then set universal delay between each image or set it up manually for each.

There are simple and more complex programs, depends on ones preference. Paint.Net also has a plugin for APNG. Also a mod for VirtualDub video editor.

http://littlesvr.ca/apng/
User avatar
Rachael
Posts: 13571
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Support for APNG animated image format?

Post by Rachael »

I am reluctant to close this outright because there is a feasible way to work this into the engine, but it would be limited in doing so. Each frame would be limited to 28.571428--> milliseconds, or multiples thereof, because of the way the current animation system is designed. (The backend animation system might be able to handle it with some modification - but not the actual existing one that is linked to the textures, the ANIMDEFS one)

But this is definitely not a simple "just load the code into GZDoom and press compile ya dummy huehuehue" that a lot of people seem to think coding work is. It would increase complexity of GZDoom in a few key parts where that may not be desirable, especially in places where it shares code with Raze. So as much as I am tempted to close this, I am going to leave it to Graf to do so - maybe he might be willing to live with the limitations and put in a more simplified version of this suggestion - or he might be willing to do a more robust and independent animation system that would allow this to actually function properly without being locked to gamesim frame multiples - or he may agree that this is more effort than it is worth, especially from a long-term maintenance view, and close this.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Support for APNG animated image format?

Post by Enjay »

Although I can't find it, I know that gif support has been suggested (perhaps more than once) and rejected before.

Similar reasons for request, as I recall. Though I am obviously aware of the limitations of the gif format versus apng (like, actual gifs, not videos that people call gifs. Kids these days...) thereby making this suggestion slightly different

I think that the main reason explored for not supporting gifs was similar to what has cropped up in this thread. Specifically that they would offer no real advantage over the methods already in GZDoom. Perhaps, if it is still a thing, the legal aspect of gif support may also have been a problem? I *think* that issue may have expired though?
venividivici
Posts: 37
Joined: Sun Feb 27, 2022 6:45 pm

Re: Support for APNG animated image format?

Post by venividivici »

I stumbled upon this thread.

viewtopic.php?f=15&t=63160

Graf scoffed at ACS and PAGEDEFS being used for video then mentions Raze that supports video formats, IIRC being SMK and AVI that neither support transparency.

GIF is limited to 8 bit color such as SMK, but also supports transparency while APNG has 24 bit color and transparency. AVI can go 32 bit color yet doesn't have transparency, but also has audio.

Found an informative thread on history of APNG.
https://twitter.com/Foone/status/1206959487434670081

This is neat if one does SVGs.
https://www.bverhue.nl/delphisvg/2021/1 ... i-or-apng/

GZDoom doesn't support GIF and supports PNG thus supporting APNG makes more sense as it is series of PNG images.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Support for APNG animated image format?

Post by Enjay »

I take, and understand all of your points in favour of the apng format (indeed, I had several of those points in mind when I made my post). The main thing I was trying to say, however, is that support for a self-contained animation format (which just happens to have been gif) has been suggested and rejected before, for reasons very similar to those mentioned here. I even have a nagging feeling that, perhaps, apng has also been suggested before, but I'm much less sure about that.

Ultimately, it's not my call and I wouldn't be left with the responsibility or headache (or not) of implementing and ongoing support of the feature. I was merely pointing out that something similar has been suggested before and, also, that the apng format is a bit niche (to me, your links to add ons and bespoke tools actually confirm as much) and nowhere near as well supported by editing tools as many other formats (admittedly, most of which are not animated - but then GZDoom has most use-cases covered). Indeed, nova++'s initial reaction underlines all that too. It's not that browsers don't support it (most do) but the format really hasn't taken off in any meaningful way and after almost a decade and a half, it's still pretty rare to actually find them I'm the wild. Browsers supporting the format doesn't seem particularly relevant to GZDoom, especially if actual usage of the format, and tool support, is so patchy. But, like I said, it's not my call.
User avatar
Rachael
Posts: 13571
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Support for APNG animated image format?

Post by Rachael »

venividivici wrote:GZDoom doesn't support GIF and supports PNG thus supporting APNG makes more sense as it is series of PNG images.
It just simply is not as simple as that. But how can I expect to reason with you if you fail to see something as fundamental as this? :blergh:
venividivici
Posts: 37
Joined: Sun Feb 27, 2022 6:45 pm

Re: Support for APNG animated image format?

Post by venividivici »

Enjay.

Issue with your reply that it hinges too much on how popular or unpopular APNG is as image format which is irrelevant because at its core APNG is series of PNG images with metadata that dictates sequence and timeframe of those.

Debate should not be on popularity as it should be on fuctionality of format and use case.

GIF is limited to 8 bit color and transparency that is also only complete while APNG is 24 bit for both while transparency can be partial/graded along no framerate limitation.

https://www.ionos.com/digitalguide/webs ... t-is-apng/

Comparing GIF to APNG is like equivalent of someone comparing NES to N64 since you again mention GIF. SMK and AVI do not support transparency, former is 8 bit and latter can be 32 bit and can support audio.

Difference between PNG and APNG is that latter has multiple PNG images with additional chunks in single file. Chunk that indicates animation and has multiple images, chunk for frame time and chunk for image data for each image in animation.

https://wiki.mozilla.org/APNG_Specification

GIF and SMK aren't worthy of consideration while AVI would be limited to pre-rendered cutscenes while something like APNG could be used in role of showing pre-rendered cutscenes along being potential to be used in game for textures and sprites.
Rachael wrote:
venividivici wrote:GZDoom doesn't support GIF and supports PNG thus supporting APNG makes more sense as it is series of PNG images.
It just simply is not as simple as that. But how can I expect to reason with you if you fail to see something as fundamental as this? :blergh:
I don't expect it to be simple, but it certainly is simpler to support APNG than GIF.

If nothing else then you Rache or Graf or someone else may be inspired by APNG to create animated PNG format suited for GZDoom.

I am a layman, but looking arounds forums and various wiki that I am questioning sanity such as that for each frame individualy its stated 8 tics.

In that situation should it only be referenced at beginning and interpreted that it switches to next image every 8 tics in order until it reaches the last one? Or better first text references number of tics and each image in file is a number coresponding to a tic.

0 is first image and then every other image has different number such as image with 8 is show when 8th tic is reached until next one replaces once ticking reaches corresponding number of it.

If GZDoom was to support APNG equivalent format then for example name it perhaps SPA = Single Package Animation.

Run.SPA animation has 4 frames then first number for example is 47 then 0, 15, 31 and 47.

I am a layman so tell me if that makes any sense to you or not at all.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”