0 votes

I'm working on a game that uses pixel art and like to keep all my pixels the same size. To achieve that, I have the zoom property set to (0.5, 0.5) on my Camera2D (I tried using the viewport stretch mode but that caused a few duplicated horizontal lines which looked really weird).

I'm trying to find a way to draw things in a pixelated way, keeping the visuals pixel-perfect (i.e. no "half-pixels"). Here's what a default Line2D looks like:

Non-pixelated line drawn by Line2D

As you can see, it doesn't really respect my camera's zoom, and its pixels are way smaller than my sprites' (the sprites are drawn to scale, so each pixel is an actual pixel and they're not scaled; only the final viewport is scaled through the camera's zoom).

Is there a way to draw that in a pixelated way? What about lights and other objects that are drawn (such as collision shapes, for example, though there's probably no use in drawing those in a pixel-perfect manner)?

in Engine by (33 points)

1 Answer

0 votes

Take a look at this :

What they propose is to have your window size corresponding to your pixel screen size (for example 160x90) and then set your stretch mode to viewport and the aspect to keep, keepwidth, keepheight depending on what you want

by (81 points)
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 Frequently asked questions and 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 [email protected] with your username.