Dealing with black frame when internal resolution doesn't scale properly to display resolution

Godot Version

v4.5.1.stable.mono.official [f62fdbde1]

Question

I have the following settings enabled in the project:

  • Stretch mode: viewport
  • Stretch aspect: keep_width
  • Stretch scale mode: integer

They are enabled for the sake of pixel art graphics, to prevent stretching and distortion.

The problem I have is that 320x180 and it’s multipliers are perfect since they will fit perfectly to every common 16:9 resolution. But in my case 320x180 doesn’t show enough and player will have issues navigating the game world, and 640x360 is a little too big, nothing awful, but I think player might have issues with precise platforming.

The only resolution in between is 480x270. But the issue is that it doesn’t scale to HD or 1440p, meaning game will find nearest acceptable resolution below the target, and leave black frame. Is there anything that can be done about it? If not I will just settle with 640x360 and make sure visuals are clear enough to make sure players can play the game without issues.

With integer scale mode the black borders are expected. More info here:

I don’t think there’s a way to avoid them and keep a pixel perfect ratio unless you use a Subviewport to render your game manually controlling the scale and fill the black borders with something else.

More info about using Subviewports here:

1 Like