0 votes

I'm trying to set up an option that lets you double the in-game resolution, going from 600x480 to 1200x960.
Currently my stretch settings are Mode:viewport and Aspect:keep. Pixel snap is also enabled. I've played around with all options, but with no luck. I've also searched excessively both on these forums and other sites, and while I have found people with somewhat similar issues, none of the proposed solutions worked for me. The code I am using to change the window size is simply OS.setwindowsize(NewResolution)

The heart of the matter:
This is a screenshot of the game running at it's base resolution. It looks the way it's supposed to.
Original resolution screenshot

This is a screenshot of the game running at precisely double resolution.
Doubled resolution screenshot

The differences might not be immediately noticeable, but I've zoomed in on a specific example for convenience's sake.

This is what the pixels are supposed to look like, scaled up manually from it's original resolution.
Scaled up correct example

And here's what the pixels look like at the doubled resolution, scaled up manually to preserve aspect ratio as well
enter image description here

As you can tell, some pixels that should have become 2x2 pixels have instead arbitrarily become 1x2 or 2x1 pixels.

If anyone can tell me what I can do to preserve the individual pixel aspect ratio when doubling the game's resolution, I would greatly appreciate it. Thank you in advance.

Edit (01-03-2021):
Just some additional information, the issue still persists. I've updated to godot 3.2.3, just on the off-chance this was a bug that had been fixed, but to no avail.

I'm using a Camera2D node to display the game, and if I keep the base resolution but have the camera be at x2 zoom (so that the sprites increase by the same amount), they look the way they're supposed to, with every pixel being at the appropriate 2x2. Obviously this still doesn't fix the problem, as playing at x2 zoom cuts off 75% of the game display, but I thought it was an interesting piece of information.

For the sake of clarity, this issue is not only for the specific purple-ship sprite I've posted in the screenshots, but for every sprite in the game.
The incorrect pixels are not consistent, and seem to change whenever the sprite moves, whether it by along the y vector or the x vector. Even if they move at exclusively whole integers, the sprites still morph. I set up a script that constantly prints out the Vector2D position to ensure that they weren't accidentally moving across any decimal vectors.

To completely ensure that I am increasing the resolution correctly, I've set up temporary code within the resolutionchange function, a single line of code stating
OS.set
windowsize(OS.windowsize*2), so that there can be no mistake that the resolution is exactly double.

Thank you for all the replies so far.

Godot version 3.1.1.stable.official pre-edit, now 3.2.3.stable.official
in Engine by (12 points)
edited by

With mode viewport and aspect keep and resizable, os.fullscreen should have added black bars around where there should be no pixels...same with resize dragging the sides... Thats how I configure most of my projects

You got something mixed there between project settings and code, that would be my best bet

os.fullscreen does indeed add black bars, yes, but the pixels do not scale correctly. When working with precise pixel art, the only way to keep the pixels consistent is by multiplying the resolution by a whole number. If I am to go into fullscreen, the resolution will go from 600 on the x vector to 1600 on the x vector, which is a multiplication of 2.6667. My code takes it from 600 to 1200, multiplying it by 2, a whole number, and yet I still have incorrect pixel scaling, which is where my problem lies. I apologize if my initial post was not clear enough. It is not a matter of problems with the aspect ratio, but the ratio of individual pixels in the sprites.

have you tried with Aspect: keep_width or keep_height?

on asset import, are you using lossless and disabling filter? (or using the 2d pixel preset)

are you by any chance changing the scale of the sprites/pixelart?

it's an odd problem you have there. My projects are all pixelart as well and I never encountered that, or maybe never noticed...

Thank you for your response. I have attempted with both keepwidth and keepheight, but neither seem to have an effect. I am using the lossless import, as well as disabling the filter. I've looked over my code several times, and nowhere are the scales of the individual sprites being changed. I'd like to reiterate that everything looks fine at the base resolution, it is only when I double it that problems begin to occur.

I'm months late and don't have an answer, but I do think I have an explanation as I'm dealing with the same issue. It seems that if the viewport resolution isnt a perfect multiple of the window resolution, you'll get weird scaling issues at random parts of the screen. For me, I'm dealing with 16x16 px sprites, and if the resolution isnt a multiple of my viewport resolution, the sprites stretch depending on their location of the screen. I think we have slightly different end goals, but I found your question while trying to solve mine and I hope I could at least give some answers as to why its happening even if I dont have a solution.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.