Questions about mipmapped icons (@posila)

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 1941
Joined: Fri Nov 06, 2015 7:41 pm

Questions about mipmapped icons (@posila)

Post by Deadlock989 »

0.18 has introduced 4-level mipmapped icons for the entire vanilla set. These are a set of 64x64, 32x32, 16x16 and 8x8 versions of the icon staggered next to each other in a 120x64 canvas.

I have some (relatively shallow) understanding of what mipmaps are for and I've read the old FFF about the issues they are intended to solve. The TL;DR, I think, is that it is really useful for hand-crafted icons when you want to preserve some important symbolic detail at lower resolutions - the best example I can think of in Factorio are the assembler icons, which have 1-3 small cogs on them to indicate the tier - downsampling them just mushes the cogs together. (Ironically, this is an icon that is almost never shipped around on belts in large quantities.) Other things with finicky detail might benefit, like wooden power poles, as long as you have someone prepared to adjust them all by hand/eye.

The current set of 0.18 stock icons ... no easy to way to say it ... they don't look great at 200% GUI scale on a 4K monitor. In fact they look noticeably worse than 0.17 in my view, but that's partly the new colour grading. The 64x64 versions within the mipmaps all look like upscaled 32x32 ones, with the exception of the ores. I'm assuming that these are placeholders, to get the system in place, with updates to the assets to come.

So I have a mod which provides several hundred new 64x64 icons. I have written a Python script which can easily mimic the 4-level mipmap format used by vanilla - it does this by downscaling the 64x64 version three times, using Lanczos resampling. So these are not icons which are going to be distinguished by level in any way, they are just resamples. (I looked at getting Blender to render and composite them at the four levels within an image, but there's absolutely no visible difference and it's much slower.) There is no chance in hell I'm going to customise any of them by level. I'm now faced with adjusting a few hundred prototypes to include the mipmap count parameter.

My question is - should I actually bother with any of this? I ran some tests with mipmapped and non-mipmapped version of the same icons. My understanding (may be wrong) is that if you supply a non-mipmapped icon, the game automatically produces its own resampled mipmap levels during atlas creation at game load. I couldn't see any visual differences at any zoom level between the Lanczos mipmapped icons and the single level icons. There was no noticeable performance benefit either, although I didn't attempt any kind of stress test, it was just a typical factory scene with a reasonable amount of stuff on belts. And the resulting filesize is larger (though not by all that much really, even with 500+ icons bumped up to 120x64).

Is there some benefit to all this potential work that I'm not understanding? e.g. to people with potatos?

posila
Factorio Staff
Factorio Staff
Posts: 4307
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Questions about mipmapped icons (@posila)

Post by posila »

Deadlock989 wrote:
Wed Jan 29, 2020 2:54 pm
My question is - should I actually bother with any of this? I ran some tests with mipmapped and non-mipmapped version of the same icons. My understanding (may be wrong) is that if you supply a non-mipmapped icon, the game automatically produces its own resampled mipmap levels during atlas creation at game load. I couldn't see any visual differences at any zoom level between the Lanczos mipmapped icons and the single level icons. There was no noticeable performance benefit either, although I didn't attempt any kind of stress test, it was just a typical factory scene with a reasonable amount of stuff on belts. And the resulting filesize is larger (though not by all that much really, even with 500+ icons bumped up to 120x64).

Is there some benefit to all this potential work that I'm not understanding?
Correct. The game will resample the icons to create all mipmap levels it needs, so providing custom mipmaps is an optional override of this mechanism. The game will use bilinear filtering, which usually produces worse results than Lanczos. If you can't see difference between in-game generated and custom generated mipmaps, than there is no benefit for defining custom ones.
Deadlock989 wrote:
Wed Jan 29, 2020 2:54 pm
The current set of 0.18 stock icons ... no easy to way to say it ... they don't look great at 200% GUI scale on a 4K monitor. In fact they look noticeably worse than 0.17 in my view, but that's partly the new colour grading. The 64x64 versions within the mipmaps all look like upscaled 32x32 ones, with the exception of the ores. I'm assuming that these are placeholders, to get the system in place, with updates to the assets to come.
Also correct. They are just upscaled old icons. Because of 71586, we felt it'll be better if we drop in final icon defintions in 0.18.0 to minimize potential mod breakage later on. Now with the campaign completely cancelled, Vaclav is 100% back on working on the new icons, so they might come earlier in 0.18 release cycle than we originally expected.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 1941
Joined: Fri Nov 06, 2015 7:41 pm

Re: Questions about mipmapped icons (@posila)

Post by Deadlock989 »

Thanks, that helps. Really looking forward to the icon update and character GUI updates.

I guess, since I'm overriding some vanilla icon paths anyway, I still have to set the mipmap count in the end, whether that's 0 or 4 I guess, so will probably just have to bite the bullet.

posila
Factorio Staff
Factorio Staff
Posts: 4307
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Questions about mipmapped icons (@posila)

Post by posila »

Deadlock989 wrote:
Wed Jan 29, 2020 3:27 pm
I guess, since I'm overriding some vanilla icon paths anyway, I still have to set the mipmap count in the end, whether that's 0 or 4 I guess, so will probably just have to bite the bullet.
You don't have to, but it's better if you do. Thank you!

Post Reply

Return to “Modding discussion”

Who is online

Users browsing this forum: btarrant