I have a 21:9 monitor with a native resolution of 2560x1080. Don’t worry, this is relevant!
I get a pointer to the UGameUserSettings object by calling GEngine->GetGameUserSettings(). At this point, the ResolutionQuality variable inside the ScalabilityQuality structure is a weird value.
I tried calling UGameUserSettings::ResetToCurrentSettings but the same problem exists. I tracked down the issue to FindResolutionQualityForScreenSize.
The default values for DesiredScreenWidth and DesiredScreenHeight (both member variables of UGameUserSettings) are 1280 and 720 respectively.
UGameUserSettings::GetDefaultResolutionScale calls FindResolutionQualityForScreenSize passing in DesiredScreenWidth and DesiredScreenHeight.
My ScreenAspectRatio is 2.37 but the AspectRation of 1280x720 is 1.77. So it tries to change the Height variable from 720 to 623.53.
As 623.53 is less than 1080 (my vertical desktop resolution) so it then changes ResolutionQuality from 100.f to 57.74.
Our game actually lets users control this via a slider, so the slider now doesn’t start at 100%, and if the user tries to change a value then the game will end up using a low ResolutionQuality and looks horrible.
I would attempt to fix this and create a pull request - but I’m confused as to what it’s even trying to do? It doesn’t make sense to me. The resolution 1280x720 would fit just fine on a 2560x1080 so why is it trying to scale anything and also changing ResolutionQuality?
Anyway, I hope that this is enough information to go on so that we can get a fix for this code!
Yeah, it’s bizarre that just playing it on an ultra-wide monitor causes ResolutionQuality to be set far lower than it should.
This line in UGameUserSettings::FindResolutionQualityForScreenSize() seems to be the culprit, and I can’t for the life of me figure out why it would be doing this – particularly when our game is often windowed, and the height of the screen itself should be irrelevant to all this. It seems like it’s assuming fullscreen mode.
if (Height < ScreenSize.Y)
{
ResolutionQuality = ((float)Height / (float)ScreenSize.Y) * 100.0f;
}
I’m afraid the person who wrote this code is no longer here so we cant ask why it was written this way. I believe it is simply trying to determine how to scale the scene rendering when you want to your window to be at the desktops native resolution but don’t have the power to render the scene at that scale. It is pretty useful for borderless, maximized windows because you want the window to be fullscreen at all times. I’ll try to dig in and see what is going on. It seems like the main issue is that it is defaulting to a resolution of 1280x720 instead of the desktop resolution. In the mean time I think you could set UGameUserSettings::bUseDesiredScreenHeight to false if you just want to control resolution quality yourself.
Unfortunately I’m sad to report that UGameUserSettings::bUseDesiredScreenHeight doesn’t exist in 4.12 (well, it definitely doesn’t in 4.12.3!). Perhaps that was only introduced in 4.13?
Did you make any progress with this issue at all?
Hi Neil,
It looks like UpdateResolutionQuality should have been called (though you could drop a breakpoint in there to verify), and that should be setting DesiredScreenWidth and DesiredScreenHeight to the proper values. It may be worth digging in and seeing why that’s never being called or why they aren’t changing off of those default values.
The setting Matt mentioned above may have just missed integrating into 4.12, so it should be in 4.13. If you want to take a look at integrating it early, take a look at GameUserSettings.h and GameUserSettings.cpp in CL# 3027184. The change is just a few lines of code, so it’s worth a shot.
Cheers,
Cody