Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HUD texture scaling bug? (verified using Wuzzy's "hudbars" mod) #2558

Closed
Pilcrow182 opened this issue Mar 25, 2015 · 10 comments

Comments

Projects
None yet
7 participants
@Pilcrow182
Copy link

commented Mar 25, 2015

There seems to be a HUD texture scaling bug, making certain textures scale much larger than they should be. I've only encountered it using Wuzzy's "hudbars" mod, but I'm betting there are other affected mods, and everything was fine a few days ago...

How it should look (modified slightly):

How it looks in the latest git version:

@kilbith

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2015

I may observe the same HUD bug...

0.4.12-stable :
screenshot_1283499211

0.4.12-dev :
screenshot_1279681088

@Pilcrow182

This comment has been minimized.

Copy link
Author

commented Mar 26, 2015

I've been compiling different versions to test, and this issue seems to have originated from commit 1e4fb80 (march 20th), as this issue was not present in 26153ba (right before it). I'm still no C/C++ programmer, but I'm sure somebody can squash this bug... ;)

@Pilcrow182

This comment has been minimized.

Copy link
Author

commented Mar 26, 2015

It would seem this might be two seperate issues: the bars themselves (the big colored areas), as well as the lobby area pointed out by kilbith, seem to have originated from commit 1e4fb80, while the oversized icons (the bread and heart in my screenshot) were from a later commit, 11372ac.

However, at the suggestion of est31, I tried adding 'texture_min_size = 0' to my minetest.conf and discovered it does actually resolve -both- problems...

@Ryan-Nolan

This comment has been minimized.

Copy link

commented Mar 26, 2015

so in the core someone needs to add texture_min_size = 0 by default if it is not defined in the conf

@Pilcrow182

This comment has been minimized.

Copy link
Author

commented Mar 27, 2015

Well, yes and no, crazyR14. If you look at the commits I mentioned, it's obvious they've changed the default texture_min_size value for a reason.

My guess is that they changed it to improve node textures or something, but didn't realize it would affect the HUD elements as well. If that is the case, it might be a better solution to just remove any references to texture_min_size from whichever function/calculation handles HUD scaling, and leave texture_min_size itself alone.

That may not be right though; I'd know more if I understood the code... :P

@Warr1024

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2015

The problem seems to be caused by the fact that the Lua API for some HUD types doesn't require a "scale" factor, and thus just uses whatever size the original image is. This will also break if someone is using a high-resolution texture pack, and the texture pack author didn't specifically avoid creating a high-res texture for the HUD bar, e.g. if the same texture by name was used in a different context where scaling wasn't a problem.

Should it even be permissible to create HUD's without specifying their on-screen size? It may have made sense in the past, when there was no need to scale the images, but HUD elements now scale manually via gui_scaling, and automatically based on DPI; since the original pixels in the HUD image might now be larger than 1 on-screen pixel, there is now a reason to want to create high-resolution textures for HUD elements.

@Warr1024

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2015

Also, texture_min_size is applied at the time textures are uploaded to the video card, after combining and transforms are applied. Unfortunately, at that time, there is no way to know whether they're destined to be used as mesh textures, HUD elements, or both.

The quickest solution may be to keep track of what upscaling was used to generate each texture, and simply apply the reverse scaling factor when rendering as HUD elements. Alternatively, an alernative texture could be created with the original scaling (if different than the final scaling) and looked up when drawing the HUD elements.

@SmallJoker

This comment has been minimized.

Copy link
Member

commented Mar 28, 2015

Got the same problem with my crosshair.png ( Version b21230b )
Kitten

@kilbith

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2015

[!] This must be marked as [blocker]

Ethic Rush server...

screenshot_20150329_230613

@Zeno-

This comment has been minimized.

Copy link
Contributor

commented Mar 31, 2015

fixed by db32e6c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.