In modern pixel art games, one will usually find the following features:

  • dpi agnostic: Having an HDPI screen does not mean the game is tiny.
  • "large" pixels: Game-pixels are big, made up of multiple screen-pixels.
  • "crisp" pixels: Game-pixels don't smoosh. They are always the same size on the screen.
  • smooth camera movement: The camera still moves in smooth screen-pixel increments. It doesn't chunk up the way game-pixels do

Here's whate I've tried so far:

If I make the viewport to match game-pixels, it can be scaled up (https://www.youtube.com/watch?v=Nsj5SGEUZhU) using advanced settings. Specifically Display > Window > window height/width override and Rendering > 2D > Snap. The issue with this is that camera/screen movement will also snap to the game-pixel size, which looks relatively jerky compared to modern pixel games. It's not smooth.

Alternatively, if I make viewport match target window size, I can use Display > Window > Stretch > Scale to make the game look right. But then Margin Containers end up targeting a screen thats scaled too large.

On top of this, I'm on an HDPI screen and everything is tiny by default. To make it work on my end, I have viewport settings at 2160 x 1440, but this is a ludicrous default for at pixel art game. Ideally, I could target a general screen size in mm, and have it figure out how to scale game-pixels to screen-pixels (2x2, 3x3, 4x4, etc) such that the window is roughly in that size range.

I recognize that this is a lot of different questions in one, but none of these things seem to be solvable in a vacuum. The results are only correct if everything works together.


1 Answer 1


I believe this tutorial covers most of what you want: How to make a silky smooth camera for pixelart games in Godot.

The idea is to have a (Sub)Viewport where you render your game world. And this Viewport will actually be larger by one world pixel margin, so you can move the image via code to have a smooth camera.

The Viewport would be in a ViewportContainer so you can scale however you want (using a ViewportTexture on a TextureRect might give more flexibility if the ViewportContainer is not quite right)

And as a bonus - optionally - you can have UI outside of the Viewport, so fonts can render with full quality.

No, it cannot target a screen size defined in millimeters. Godot does not have such feature.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .