IT lexicon › Programming › Pixel snapping

Pixel snapping

Programming På svenska → Updated: 2026-10-27

Rounding sprites and the camera to whole screen pixels before drawing, so pixel art does not shimmer, stretch or grow half-pixels when it moves.

A modern 2D engine works in floating point. A sprite at x = 10.4 is drawn either with filtering, which blurs it, or with nearest-neighbour sampling, which occasionally makes a column of pixels twice as wide. With a slowly scrolling camera this shows up as a creeping shimmer across the whole screen — exactly what pixel art was supposed to avoid.

The fix is to let the game logic keep its decimals and round only at draw time, usually to the low resolution the game pretends to run at. Unity's Pixel Perfect Camera and Godot's option to snap 2D transforms do exactly this. The trade-off is that slow movement turns jerky, one pixel at a time — essentially the same phenomenon as PlayStation vertex snapping, only this time on purpose.

← Back to the lexicon