Add support for AVIF

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
alexman91
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon May 03, 2021 2:42 pm
Contact:

Add support for AVIF

Post by alexman91 »

please allow the game to use avif its much more efficient and smaller.
my mod folder is taking up 4gb of png files this can be reduced by 70% with avif.
there are batch apps to convert all png to avif lossless

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Add support for AVIF

Post by ssilk »

Doesn’t make much sense, because it needs to be unpacked when loading, which takes up some more time. Then it seems to be a non-loseless kind of compression which is bad , because in Factorio every pixel counts. And unpacked into memory the images have the same size, because that’s what’s done to make the graphics fast... I would mean the prize for 3 GB on your hard disk is much cheaper, than these disadvantages. ;)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Add support for AVIF

Post by ptx0 »

alexman91 wrote:
Mon May 03, 2021 2:47 pm
please allow the game to use avif its much more efficient and smaller.
my mod folder is taking up 4gb of png files this can be reduced by 70% with avif.
there are batch apps to convert all png to avif lossless
4gb of disk space is a problem? it is not 1998

coderpatsy
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Tue Apr 17, 2018 11:45 pm
Contact:

Re: Add support for AVIF

Post by coderpatsy »

ssilk wrote:
Tue May 04, 2021 6:36 am
Then it seems to be a non-loseless kind of compression which is bad , because in Factorio every pixel counts.
As mentioned in the OP, AVIF does have a lossless mode. I've no clue about unpacking time/memory so your other points probably still stand though.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Add support for AVIF

Post by ssilk »

Avif sucks hard for lossless compression.

See https://jakearchibald.com/2020/avif-has-landed/ (-> flat illustration)

If that’s all true, then lossless WebP seems to perform better. But for these 10-20% - I don’t know if that makes sense. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Add support for AVIF

Post by ptx0 »

ssilk wrote:
Wed May 05, 2021 2:15 am
Avif sucks hard for lossless compression.

See https://jakearchibald.com/2020/avif-has-landed/ (-> flat illustration)

If that’s all true, then lossless WebP seems to perform better. But for these 10-20% - I don’t know if that makes sense. :)
generally the tradeoff is in the size vs performance. better compression is going to be slower both in decompression and compression. so, you'll sacrifice load times.

overall a bad idea for no gains

Hornwitser
Fast Inserter
Fast Inserter
Posts: 204
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

Re: Add support for AVIF

Post by Hornwitser »

There's more to it than just disk space, the mod portal currently has a maximum file size of 262.1 MB and we already see mod authors employing lossy PNG compression in order to make their mods fit into that file size limit. Supporting AVIF would enable mod authors to deliver higher quality sprites in less space than lossy PNG compression does.

Take for example the animated dish in Space Exploration, the original PNG sprite sheet (left) is 36 MB and compressed with pngquant to reduce the file size to 12 MB (middle), if AVIF was supported it could be used instead to compress it to 6 MB (right) while IMHO looking better than the pngquant output.
comp.png
comp.png (2.4 MiB) Viewed 1823 times
Notice how the reduced colour palette of the pngquant version causes very visible dithering in the top left shadow and the edges of the circuit wire. The AVIF compression does not have this issue and more colourful sprites would make the visual difference between pngquant and AVIF even greater.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2483
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Add support for AVIF

Post by FuryoftheStars »

Hornwitser wrote:
Wed Aug 17, 2022 9:36 pm
There's more to it than just disk space, the mod portal currently has a maximum file size of 262.1 MB and we already see mod authors employing lossy PNG compression in order to make their mods fit into that file size limit. Supporting AVIF would enable mod authors to deliver higher quality sprites in less space than lossy PNG compression does.

Take for example the animated dish in Space Exploration, the original PNG sprite sheet (left) is 36 MB and compressed with pngquant to reduce the file size to 12 MB (middle), if AVIF was supported it could be used instead to compress it to 6 MB (right) while IMHO looking better than the pngquant output.

comp.png
Notice how the reduced colour palette of the pngquant version causes very visible dithering in the top left shadow and the edges of the circuit wire. The AVIF compression does not have this issue and more colourful sprites would make the visual difference between pngquant and AVIF even greater.
I honestly almost can't tell the difference without magnifying them even further, and considering they will be smaller than this even in normal gameplay, I'd say the concerns around load times and performance are more important (to me personally).

As for the mod portal, that's easy to solve: advocate for the size limit to be raised. 'Cause, yeah, disk space is cheap in comparison these days.

--------------------------------------

Edit: Just to add (for general purpose of the thread, not a direct reply to the quoted post above), while I am for increased quality of sprites and all, I am not for it if it impacts game performance. I do have and use some HD graphics mods. But if any mod I played used a graphics format that slowed down game loading/play significantly (such as using this AVIF format), I'd probably ask if they could release a version that doesn't use it (defeating the purpose, yes?), and if they declined, then I'd probably drop the mod. As it was, I was very close to dropping the HD graphics mods I used because of their impact on load time (which was all data stage script related) until the devs released that update that greatly sped up the process.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Hornwitser
Fast Inserter
Fast Inserter
Posts: 204
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

Re: Add support for AVIF

Post by Hornwitser »

FuryoftheStars wrote:
Wed Aug 17, 2022 11:28 pm
I'd say the concerns around load times and performance are more important (to me personally).

As for the mod portal, that's easy to solve: advocate for the size limit to be raised. 'Cause, yeah, disk space is cheap in comparison these days.
The file format makes no difference to the performance of the game. No matter the image format they will all be converted to the same RGB texture format when loaded on the GPU. Since you say disk space is of no concern and load times is everything then there's already a great solution for you: Turn on cache-sprite-atlas and have a couple of GB of disk space wasted to make the game load faster by caching the RGB textures that would be loaded onto the GPU uncompressed on your hard drive.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2483
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Add support for AVIF

Post by FuryoftheStars »

Hornwitser wrote:
Thu Aug 18, 2022 1:44 pm
The file format makes no difference to the performance of the game. No matter the image format they will all be converted to the same RGB texture format when loaded on the GPU.
Ok, but they do affect load time. The AVIF format sounds like it would take longer for the game to load than png. Again, I already almost abandoned some other mods over their affect on the load time and that was over the data stage script, not the actual decompression/conversion of the images.
Hornwitser wrote:
Thu Aug 18, 2022 1:44 pm
Since you say disk space is of no concern and load times is everything then there's already a great solution for you: Turn on cache-sprite-atlas and have a couple of GB of disk space wasted to make the game load faster by caching the RGB textures that would be loaded onto the GPU uncompressed on your hard drive.
To my last understanding, if anything changes, it dumps and reloads the whole set (and considering how often I'm changing things, that makes it near worthless for me) and is an experimental feature that is not 100% known to be stable or supported.

I did give it a try once upon a time, though. For me, it seemed to have a very minor impact. *shrug*
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

User avatar
Nosferatu
Fast Inserter
Fast Inserter
Posts: 228
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Add support for AVIF

Post by Nosferatu »

Can anyone point to a decoding benchmark?
I only found encoding and quality tests.

Shadow_Man
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Fri Mar 02, 2018 2:55 pm
Contact:

Re: Add support for AVIF

Post by Shadow_Man »

Maybe JPEG XL will be better choice?
As fast as JPEG, but much more higher quality than other HD graphics formats (HEIF, AVIF etc).
Lossless compression, animation supprt and more...
https://jpegxl.info/

Koub
Global Moderator
Global Moderator
Posts: 7175
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Add support for AVIF

Post by Koub »

I was thinking it would be ironical if the devs Bloated Factorio with all these fancy new better image formats support and made Factorio heavier by tens or hundreds of megabytes for all the players, just to shave off a Gb from the mods folder for a handful of players who play with huge mod packs.
Koub - Please consider English is not my native language.

Post Reply

Return to “Ideas and Suggestions”