DEV Community

FrameSprite
FrameSprite

Posted on

I tested 0, 1, 2 and 4 pixel sprite-sheet gutters instead of guessing

Sprite-sheet advice often collapses to one number: “add two pixels of padding.” That is easy to repeat and hard to evaluate. Padding only works in relation to the sampler, output scale, mipmap path and atlas geometry.

I wanted a smaller question that could be reproduced: when two different sprite cells touch, how much does nearest or bilinear sampling let the right cell influence the left one?

The test

The test starts with the first two cells from a public FrameSprite bone-dragon sheet. Each character image is alpha-trimmed, placed in an equal-sized cell and edge-aligned. The pair is then repacked with 0, 1, 2 or 4 fully transparent pixels between cells.

For each gutter, the script samples at 100%, 50% and 25% using nearest and bilinear filtering. The final sample is positioned a quarter source pixel inside the left cell boundary. A same-neighbor control supplies the baseline. If replacing the neighbor with a different frame changes a sampled RGBA channel by more than eight, that pixel is counted as contaminated.

Sprite-sheet gutter comparison across nearest and bilinear sampling

What the controlled test found

Gutter Nearest Bilinear
0 px No measured contamination 156 / 78 / 40 affected rows at 100% / 50% / 25%
1 px No measured contamination No measured contamination
2 px No measured contamination No measured contamination
4 px No measured contamination No measured contamination

One pixel separated the two bilinear taps used here. It would be tempting to stop at “one pixel is enough,” but that conclusion would exceed the experiment. The script did not generate mipmaps, apply texture compression, use repeating wrap modes or send the sheet through Unity's or Godot's atlas packer. Each of those can change how far a sample reaches or how edge colors are reconstructed.

A more useful rule than one universal number

  1. Export real transparent space. An editor spacing field cannot create pixels that are absent from the PNG.
  2. Keep logical frame size separate from gutter size.
  3. Enter the exact exported spacing in the engine slicer.
  4. Test the target filter, smallest display scale and platform build.
  5. For bilinear filtering or mipmaps, test a larger gutter and alpha-aware edge dilation.

Edge dilation matters because a fully transparent pixel still has RGB channels. Extending the nearest visible edge color into transparent gutter pixels, while keeping alpha at zero, can prevent black or colored halos during interpolation.

Reproduce or challenge the result

The full benchmark publishes the JSON rows, CSV, comparison image, source bounds, threshold and limitations. It also maps the result to Unity and Godot settings:

https://www.framesprite.com/guides/sprite-sheet-padding-gutters?utm_source=devto&utm_medium=technical_article&utm_campaign=sprite_gutter_benchmark_20260831

If you run the data through a mipmap or platform-compression test, share the atlas settings and the first mip level where the result changes. That is the next experiment this small test does not answer.

Top comments (0)