Pixel-perfect settings in Godot 4

The project settings that keep pixel art sharp when the window is scaled.

SNP 055 #539 Filed godot gamedev pixelart

In Project Settings:

  • Display → Window → Size: viewport width and height to your game's resolution, say 320 × 180.
  • Display → Window → Stretch → Mode: viewport, so the game renders at 320 × 180 and the result is scaled up.
  • Display → Window → Stretch → Aspect: keep, black bars rather than stretched pixels.
  • Display → Window → Stretch → Scale Mode: integer (Godot 4.2+), only whole multiples, so every pixel is the same size.
  • Rendering → Textures → Canvas Textures → Default Texture Filter: Nearest.

Or the same in project.godot:

ini
[display]
window/size/viewport_width=320
window/size/viewport_height=180
window/stretch/mode="viewport"
window/stretch/aspect="keep"
window/stretch/scale_mode="integer"

[rendering]
textures/canvas_textures/default_texture_filter=0

viewport mode also snaps sprites to the pixel grid for free; canvas_items mode scales smoother but lets sprites sit between pixels.