• 2D
  • Resolution Issues, Iconsistent lines/positioning with 2D Pixel Snap enabled

As the title suggests, something's off with my resolutions. I'm putting pictures of the settings I'm using below, but regardless of what settings I use the lines on these boxes are not consistent, even though they are in the sprite. the object nor sprite have any sort of scaling or transformation modifications either.

How it looks up close, in the editor:

How it looks rendering set to 2D

How it looks set to ignore:

Usual Settings:

Do the lines look consistent at 100%? Even with pixel snap any stretching is going to be subject to some interpolation.

@bitshift-r said: Do the lines look consistent at 100%? Even with pixel snap any stretching is going to be subject to some interpolation.

I believe so; they come out to similar patterns regardless of the resolution; be it my 1080, or my brother's 1366. I've got this line setup

 func window_resize():
	get_viewport().set_size_override(true, OS.get_window_size())

with the hopes of setting the viewport to whatever the monitor's res is to fix the issue; maybe the scaling isn't working as intended, but the pattern of interpolation is pretty consistent. It made me think there might be some other cause, but idk. Do you think setting it up to also scale the actual Width/Height as well as the Viewport would change anything? As a pltaformer, the amount the player can see is very important, so I feel like the experience would change significantly for people on larger or smaller monitors if the Height/Width also changed; unless I've got it backwards and the Viewport needs to be stuck to 1600x900, and the Height/Width is what needs to be adjusted to get the desired effect.

For pixel perfect sprites your viewport size should match the window resolution, or at least scaled by a whole number (200%, 300%, 400%, etc).

I completely agree that it's important to keep the experience consistent, but unfortunately that means scaling. And any scaling will introduce these types of artifacts with 2d images.

If you want to maintain a pixel art aesthetic then you might have a more acceptable result if you target a smaller size and scale that up. For example your window size and viewports could be set to 960x540, so fullscreen on a 1920x1080 monitor would be a 200% scale, and your pixel art should be consistent. You will get scaling if you go fullscreen at 1366x768, but it will look fine at 100% windowed at that resolution.

@bitshift-r said: For pixel perfect sprites your viewport size should match the window resolution, or at least scaled by a whole number (200%, 300%, 400%, etc).

I completely agree that it's important to keep the experience consistent, but unfortunately that means scaling. And any scaling will introduce these types of artifacts with 2d images.

If you want to maintain a pixel art aesthetic then you might have a more acceptable result if you target a smaller size and scale that up. For example your window size and viewports could be set to 960x540, so fullscreen on a 1920x1080 monitor would be a 200% scale, and your pixel art should be consistent. You will get scaling if you go fullscreen at 1366x768, but it will look fine at 100% windowed at that resolution.

Good info. If that's the case, it may be too late for this project, but lesson learned for the next.

Is there any kind of combination of settings that would force it to just forcibly stay at 1600x900, regardless, and just have black borders around the outside as needed? I thought that's what Keep would do but it seems to be scaling regardless; maybe that aforementioned code is overriding it?

If you set the stretch mode to disabled the pixel size will not change, but you will see more of your scene rather than black. To "correct" this you could make a mask (a black polygon with an opening the size of your viewport) and attach it to your camera to black out "out of bounds" areas. Or if fullscreen isn't required you can just disable resizeable in the Window settings.

@bitshift-r said: If you set the stretch mode to disabled the pixel size will not change, but you will see more of your scene rather than black. To "correct" this you could make a mask (a black polygon with an opening the size of your viewport) and attach it to your camera to black out "out of bounds" areas.

How would you go about keeping it centered though? Wouldn't it default to being in the top-left corner of the monitor? Or if you offset that, be slightly off-center for off-res monitors?

Set project setting stretch to "2d" and aspect to "expand". I think that will keep things centered. You may need to black off the sides though, or allow it if it doesn't hurt the game.

I actually am still getting some distortion, even with the Stretch Mode set to disabled.

@cybereality said: Set project setting stretch to "2d" and aspect to "expand". I think that will keep things centered. You may need to black off the sides though, or allow it if it doesn't hurt the game. That's what I've been using actually; 2D Expand and 2D Keep got me the best results, but there was still an excess of interpolated pixels.

17 days later