Low Res Pixel Art Diffrent Sized Pixel Stretching

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

Hello, I’ve started a couple projects with Godot so far, but in each one my pixel art was having very apparent different sized pixels. Some would be wider or taller while others would end up really small.
For most my pixel art I’m planning to go for a viewport size of 512 by 288. It should give my low res pixel art plenty of room and allow it to not have a hardware problem of too few pixels when you full screen it, but it still stretches it.
The only way I’ve come close to fixing it was when I had these settings:
Pixel snap
2D and Keep Aspect Ratio
(No filter for importing images)
Shrinking a camera 2d nodes zoom to 0.5

These settings seem to give each pixel the proper room to not be stretched, but having to set a camera zoom to 0.5 is really annoying, and I would prefer to just keep the viewport size 512 by 288 and not use a Camera 2D node.
What changes do I need to make to get perfect pixel sizing?

:bust_in_silhouette: Reply From: Asheraryam

Changing the camera zoom is not necessary, but you will need to adjust the scale of the game manually to fit the screen size.

Here is a tutorial with code for how to make the game screen adjust for pixel art.
https://alvarber.gitlab.io/pixel-perfection-in-godot.html

I also found this reddit post with some helpful comments.
https://www.reddit.com/r/godot/comments/6s9nva/pixel_perfect_scaling/

And this.

Thank you a lot. These look like they will help and should make my game look nice and crisp.

DoctorPumpkins | 2019-11-09 03:52

ty, that script is the only way

Zelta | 2021-12-22 00:37