Game dev
Saved & recent

Pixel-perfect rendering

Related terms: pixel art, integer scaling, pixel snapping, nearest filtering

Drawing pixel art so source pixels line up consistently with the output pixel grid. Whole-number scaling keeps each source pixel the same size, and nearest filtering keeps edges crisp.

Camera position, sprite placement and render resolution also matter. Fractional scaling can give pixels uneven widths; subpixel camera movement can make edges shimmer. A common setup renders to a fixed small target and scales that image by an integer.

Further reading
MDN: Crisp pixel art look with image-rendering
3× scale 2.5× scale equal widths uneven widths
The two grids show the same sprite with nearest filtering. At 3× each source pixel covers three output pixels per axis. At 2.5× the widths alternate between three and two pixels.

View in the full Game dev collection