Accurate HUD Scaling at Lower Resolutions

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE/EDuke32/Raze? Did your computer break? Ask here.

Moderator: GZDoom Developers

Forum rules
Contrary to popular belief, we are not all-knowing-all-seeing magical beings!

If you want help you're going to have to provide lots of info. Like what is your hardware, what is your operating system, what version of GZDoom/LZDoom/whatever you're using, what mods you're loading, how you're loading it, what you've already tried for fixing the problem, and anything else that is even remotely relevant to the problem.

We can't magically figure out what it is if you're going to be vague, and if we feel like you're just wasting our time with guessing games we will act like that's what you're really doing and won't help you.
Post Reply
speedy
Posts: 8
Joined: Sun May 02, 2021 12:45 pm
Graphics Processor: Not Listed

Accurate HUD Scaling at Lower Resolutions

Post by speedy »

I've noticed when using 640x400 or 320x200 mode on my 2880x1800 HiDPI laptop LCD that the HUD's pixels seem to be scaled correctly even with linear filtering set to None...

But, if I switch to a Normal + 0.25 scale or use the "Lowest Possible Scale" mode the HUD's pixels aren't scaled properly (referring to vertically mostly) - some lines/pixels look like they're sometimes double-height where others are correct.

Is there a way to address this so I can play in widescreen with chunky pixels and have a HUD that appears to be scaled correctly?

Thanks!
Last edited by speedy on Sun May 02, 2021 10:36 pm, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Accurate HUD Scaling at Lower Resolutions

Post by Graf Zahl »

If you use a size too close to your actual resolution that isn't a whole factor, such artifacts are unavoidable.

Let's say you want to stretch 200 pixels to a display size of 300. The only way to achieve this is to double each second pixel so you have a display of 1/2/1/2 and so on.
Those small sizes like 320x200 and 640x400 are only 1/5th or 1/6th, so you alternate between a scaling of 5/6 or 10/11 screen pixels per source pixel at which the effect is barely noticable. The closer you get to your real screen size, the more noticable it gets.
speedy
Posts: 8
Joined: Sun May 02, 2021 12:45 pm
Graphics Processor: Not Listed

Re: Accurate HUD Scaling at Lower Resolutions

Post by speedy »

You need to do the math yourself to set custom scaling like this...

ScaledY / NativeY = Y * NativeX = X * 1.2 = ScaledX

You'll always know your ScaledY because that's the vertical resolution you want to achieve (400p in my case). You're solving for the ScaledX.

Then run the command:
vid_setscale ScaledX ScaledY 0 1.2

For example, my laptops LCD is 2880x1800 so I'd calculate like this:
400 / 1800 = .222 * 2880 = 640 * 1.2 = 768

So I ran the command:
vid_setscale 768 400 0 1.2

Now my HUD looks perfect and I have a nice 400p widescreen render resolution.

Rachel showed me on Discord how to do this (THANK YOU!).
Last edited by speedy on Mon May 03, 2021 9:36 am, edited 1 time in total.
User avatar
Rachael
Posts: 13561
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Accurate HUD Scaling at Lower Resolutions

Post by Rachael »

speedy wrote: Rachel showed me on Discord how to do this (THANK YOU!).
You're welcome.

It shouldn't be this hard to do it, but the main reason why I haven't extended the code further is due to extension after extension the code has been in desperate need of refactoring that I just haven't gotten around to yet. It's a mess, and I am ashamed that I let it get so bad, but it's why I am not adding features to it right now.
speedy
Posts: 8
Joined: Sun May 02, 2021 12:45 pm
Graphics Processor: Not Listed

Re: Accurate HUD Scaling at Lower Resolutions

Post by speedy »

I wanted to add a couple more details for anyone else who may stumble on this thread...

I had to set r_noaccel true for scaling to avoid scaling issues on certain sprites on my weapon. Rachel mentioned to me that this is likely due inefficiencies with the float datatype. You can see the issue here: https://youtu.be/nwiFsROPJtQ

Doing this also requires switching to the "Doom Software Renderer" or "True Color SW Renderer" which I preferred regardless because of the vanilla look I was going for.
Post Reply

Return to “Technical Issues”