[1.1.104] Trilinear filtering between incompatible mipmaps
Posted: Tue Mar 05, 2024 2:55 pm
This is a minor but noticeable rendering issue that arises from the combination of two non-bugs:
The most obvious places where 2) applies are __core__/graphics/icons/mip/slot_ammo_white.png and __core__/graphics/icons/entity/character.png, which are often visible in the GUI. Here I have superimposed the largest mip level (cyan) over the second-largest (red, 2x upscaled with no interpolation).
For slot_ammo_white.png it appears the relative scales and positions of the two mip levels are different, so when they are trilinear-filtered there is visible blurring.
Similarly for character.png, the mipmaps don't quite align. As a result the icon appears blurred at UI scale 125 and the 'ghosting' effect on the RHS is really obvious at UI scale 150.
I have checked this issue does not just affect me: looking at screenshots other people have posted on Discord over the past week or so, every image I have found that contains an equipment bar at UI scale 125 or 150 appears to have this problem (red boxes are mine, everything else isn't).
Expected result: Here is what I believe it is meant to look like at scales 125, 150. I have turned off trilinear filtering by removing the linear-mip-level flag from both SpriteOption::Icon, and 'icon' in SpriteFlagHelpers::optionsList. The blurring / ghosting has gone.
- Icons have flags 'linear-minification', 'linear-magnification', 'linear-mip-level'. So if the game interface has a UI scale that results in icon sizes between mipmap levels (i.e. UI scales 75, 125, 150, 175 for most icons) then they are rendered with trilinear filtering.
- Some icons (predominantly in __core__/graphics/icons/mip) have mipmaps that do not appear to be proper mipmaps: instead of being downscaled, they look like slightly different renderings at a lower resolution.
The most obvious places where 2) applies are __core__/graphics/icons/mip/slot_ammo_white.png and __core__/graphics/icons/entity/character.png, which are often visible in the GUI. Here I have superimposed the largest mip level (cyan) over the second-largest (red, 2x upscaled with no interpolation).
For slot_ammo_white.png it appears the relative scales and positions of the two mip levels are different, so when they are trilinear-filtered there is visible blurring.
Similarly for character.png, the mipmaps don't quite align. As a result the icon appears blurred at UI scale 125 and the 'ghosting' effect on the RHS is really obvious at UI scale 150.
I have checked this issue does not just affect me: looking at screenshots other people have posted on Discord over the past week or so, every image I have found that contains an equipment bar at UI scale 125 or 150 appears to have this problem (red boxes are mine, everything else isn't).
Expected result: Here is what I believe it is meant to look like at scales 125, 150. I have turned off trilinear filtering by removing the linear-mip-level flag from both SpriteOption::Icon, and 'icon' in SpriteFlagHelpers::optionsList. The blurring / ghosting has gone.