Problem downscaling resolution

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Relo

Hello, I was making a prototype and i wanted to setup my resolutions ahead properyl.

To give context…

I read Multiple resolutions doc and followed gdquest tutorial on resolution settings, I’m making all the assets in 4k to support it, so by design is 4k.

My project configuration window looks like this:

Width = 3840
Height = 2160
Test Width = 1280
Test Height = 720
Resizable = on
Stretch Mode = 2d
Stretch Aspect = keep
Stretch Shrink = 1

If I run the game, the debug window (with the test size) works like a charm if I resize it, all shrinks correctly:

Initial resolution
Imgur

Resizing window
Imgur

Then, when I manually change the resolution in code, this happens:

Chaging resolution by code:
Imgur

Imgur

It is like instead of scaling to the new smaller resolution, is croping the excess pixels and doing a zoom… I cannot wrap my head around this.

The code for changing the resolution:

func update_settings(settings: Dictionary) -> void:
get_tree().set_screen_stretch(
	SceneTree.STRETCH_MODE_2D, SceneTree.STRETCH_ASPECT_KEEP, settings.resolution
)

OS.set_window_size(settings.resolution)

It has the same stretch modes as configured in project settings…

I also tried changing it simply by

	OS.set_window_size(settings.resolution)

and not setting the stretch modes. This seems to be working as intendeed(not doing zoom and scaling) but it creates weird artifacts when fullscreen:

Imgur

All this this are happening in the editor, in the debug executable for windows and in the release executable for windows.

Any ideas on how to solve this?