Page MenuHomeFeedback Tracker

Forcing lower mipmaps for UI pictures
New, NormalPublic

Description

I'd like to request a way to force usage of lower mipmaps for pictures for use on UI. Personally I need this for a structured text icons, but having more general solution would be useful as well.

Currently all UI pictures are drawn using mipmap 0, this creates problems when you try to display high resolution images in small size, for example CfgWeapons pictures inside text, they end up really crispy and aliased. Another usage would be normalizing quality between different pictures drawn near each other, in case they're of different resolution.


Here is how I see it working with image attributes:

  1. Force drawing mipmap 2:
<img image='texture.paa' mip='2'/>

If this mipmap doesn't exist, use closest one from 2 to 0 that does.

  1. Force drawing closest mipmap to target pixel height:
<img image='texture.paa' mipheight='64'/>

Use mipmap with height closest to provided mipheight.

  1. Maybe also have mipui which would select most appropriate mipmap for the provided UI height?
<img image='texture.paa' mipui='0.04'/>

Having this feature will let us display high resolution images as small pictures without terrible aliasing.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Here is test hint that uses new suggested attribute alongside no-mip selection image:

hintSilent parseText format [
	 "This looks way too crispy: <img image='%1'/><br/>But this hopefully doesn't: <img image='%1' mipheight='32'/>"
	,getText(configFile >> "CfgWeapons" >> "arifle_MX_SW_F" >> "picture")
];
Additional Information

Alternative names for the attributes:
mip_index = '2'
mip_height = '64'
mip_ui_height = '0.04'

Event Timeline

SaMatra created this task.Mar 5 2023, 1:10 PM
SaMatra updated the task description. (Show Details)Mar 5 2023, 2:01 PM

mipmap='2'
mipmaph='32'
mipmapui='0.04'
More name ideas

This comment was removed by Geez.
Geez added a subscriber: Geez.Mar 10 2023, 9:36 AM

Another attribute name idea, same property name, different values:
mipmap='#2'
mipmap='32px'
mipmap='0.04'
or usemip or just mip as original idea had it.

BIS_fnc_KK added a comment.EditedMar 18 2023, 9:42 AM

don’t hold your breath for it, I have tried to force the game to display lower res on textures and it proves to be more difficult than expected. Everything is geared towards showing you the best possible quality so telling the game you want to try higher quality might work but lower quality usually ignored. It also interconnected with video options texture quality. On top UI always uses max res because why not. What exactly is the use case, why can’t one use a thumbnail? maybe there is another simpler solution because right now it looks like too much work too little gain

What about having it as procedural texture?

"#(argb,x,x,1)findmip('\A3\weapons_F\Rifles\MX\data\UI\gear_mx_lmg_X_CA.paa', '2px')"
"#(argb,x,x,1)findmip('\A3\weapons_F\Rifles\MX\data\UI\gear_mx_lmg_X_CA.paa', '#2')"
"#(argb,x,x,1)findmip('\A3\weapons_F\Rifles\MX\data\UI\gear_mx_lmg_X_CA.paa', 0.04)"

The procedure takes found mipmap and creates a new texture out of it. Preferably with automatic size ignoring input sizes, maybe as optional parameter to fit it into input size or adjust size automatically as 3rd parameter?

More names: getmip, selectmip, frommip, or just mip

The use case is displaying high resolution textures in small sizes to avoid ugly aliasing.

For example, currently I have to generate several files for my logo texture and select different fit better for current resolution and UI size, but this approach won't work with existing content.

	private _logo_width_pixels = _logo_width / pixelW;
	_ctrl_logo ctrlSetText (switch(true) do {
		case (_logo_width_pixels > 256):	{"i\logo512.paa"};
		case (_logo_width_pixels > 128):	{"i\logo256.paa"};
		default					{"i\logo128.paa"};
	});

This is how logo looks on the game map with my code VS how it would look like if I just used highest resolution logo:

Displaying weapon icons inside text is another actual use case - showing icons in kill feed in the corner of the screen. Displaying 1024x512 weapon texture in 20 pixels high text line makes it look really crispy and aliased, while there is properly downscaled 64x32 mipmap right in the file.

And this is my absolute best attempt to make it look as decent as possible, I had to make actual images be even bigger than text, made it use shadow=2, it would've looked much worse as is.