UMG Scale issues

Hey there,

I am converting my current HUD into UMG and I have ran into an issue, I tried to compensate for the differences in resolutions by using the DPI scaling, but I found out that it only works as long as the new aspect ratio is the same as the original aspect ratio, otherwise the scaling causes issues.
at 1366x768(16:9) http://i.imgur.com/G0iP2xE.png
at 1024x768(4:3) http://i.imgur.com/PBJkzFG.png

So I decided to create my own scaling function (and I’ve set the DPI scaling to 1) which just compares the difference between original resolution (1920x1080) vs the current one and finds out the difference, then changes the Render Scale of the widget, The widget is scaled correctly but parts of the widget that would be outside of the screen before I change the Render Scale get cut off.

at 1366x768(16:9) http://i.imgur.com/SpnjVSX.png
at 1024x768(4:3) http://i.imgur.com/wUkaD4O.png

Ideally I would like to be able to scale the widgets, without having parts of them cut off.

Any ideas would be greatly appreciated.

First congratulations by the project (I’ve seen some from your videos before).

About your custom method I have few to add, but as “idea”…

Have you checked that Epic’s built in DPI scale has 2 evaluation methods?

Maybe changing the evaluation rule could save you some time.

Best regards

I’ve tried that, but I have always came across scaling issues… I can get it to scale all correctly as long as the aspect ratio is 16:9, but “always” I run into issues either with 4:3 or 16:3 (triple screen stuff), I cannot take into account both height and width, but only one of those with the DPI curve.

It would be ideal if there was possibility to manually modify the curve or the DPI scale on the fly via either c++ or blueprints

I’m still learning Blueprints so this could be a complete stab in the dark that may not help at all, but could you not simple scale according to one axis? I’m assuming you want to keep what looks like the inventory window a square, so if you scale to the height instead of width you might get better results? For example someone running 3x 1920x1080 monitors will have a 5760x1080 viewport so there’s no real need to change it? The height is the same.

Yeah the height is the same, but then there is issue if they use 4:3 resolution (note the second picture).

for now what I’ve done is plot most common Widths (800, 1024, 1280, 1600, 1920, 3840, 4096, 5760) onto the graph and manually assigned scale to them, but ideally I would like to be able to scale across all aspect ratios…

looks like a pproblem with anchors. at least the relative distance to screenborder looks the same in both resolutions…if you scale it yourself, you probably have to adjust anchors yourself as well…just a wild guess though!

I’ve tried messing with the anchors too, but it didn’t help. Either widgets would overlap, or be partially cut of in most cases… As I said before, so far only possibility to get this working has been to manually plot the various widths onto the graph and manually set scale.

That’s the plan, probably for 4.8. There’s going to be a new entry in that list that says Custom, and you’ll be able to pick a class that can do whatever logic you want instead of shortest side…etc.

You could put your UI pieces together inside of a scale box. That would scale them down based on the shortest side.

That is awesome! looking forward to it, I guess it will be sooner available either in master or promoted builds right?

I tried using scale box, putting a canvas panel inside it, and putting all my widgets inside that, It broke everything, tried putting each widget into its own scale box, but it just messed up. either its not the way to go, or im doing something wrong… or the version of engine I’m using has this bugged (I use the promoted builds from github)

[MENTION=2522]Nick Darnell[/MENTION] I see this “Custom Scaling Rule Class” is in there now, but I can’t figure out what class to extend to try and make a new rule, and couldn’t see it anywhere in the documentation. Is it a C++ only class? (not exposed to BP?)

I have a basic “linear ramp” horizontal DPI scale that works well for all the mobile devices but I’m doing a set of custom menus for PC and I want to scale differently there. If doing a “Custom Scaling Rule Class” in BP is not possible I guess I will just have to paste some BP scaling logic into all my PC menu parent panels or something.

UDPICustomScalingRule, C++ only. Wasn’t planning to expose it to blueprints, might make it possible to the demand is strong enough. Would need to cache the results for a given size so that the performance is reasonable.

The demand is now strong enough! :wink:

Just ran into this same problem. Just FYI in case others are having this issue.

still not exposed to blueprint… cant fix my dpi problem at 4.20 due to not haveing scaleing class laggs editor big time, and haveing presets messes up widgets for android…

I’m actually facing extreme scaling issue due to how DPI scaling rule work, I wan’t to have my UI to rescale on both axis equaly, like 1280x720 = Scale(1,1) and then for like 640x320 = Scale(0.5,0.5) but it seems DPI scale system only allow one dimension to determine the scaling rule.
How can I solve that ? (working on 4.21.1)