GUIDE // ANY ENGINE

How to prevent seams between cells in a sprite sheet

Seams appear when your engine samples pixels from the neighboring cell, through filtering, mipmaps or compression. Leave an empty, transparent border inside every cell, keep the effect off the cell edge, use tile sizes that divide the sheet evenly, and limit mipmaps on sheets that are only ever seen close up.

  • Godot 4 Available
  • Unity Manual setup
  • Unreal Engine Manual setup
  • Roblox Studio Manual setup
  • three.js Available

A draft compile is from $0.05, and new accounts start with $5 of usage.

WINDOW_FIREFINAL
First frame of the window_fire bake
Window fire, 3.9 x 4.7 m, compiled with Spatial Compiler. Spec →

01 // CAUSES

How the next cell leaks in

  • Filtering: at the edge of a cell, bilinear filtering blends in the first pixel of the cell beside it.
  • Mipmaps: each smaller mip level averages blocks of pixels, so a 256 px cell becomes a 16 px cell four levels down, and its border melts into the neighbor.
  • Compression: block formats squeeze 4 x 4 pixel blocks, so a cell size that is not a multiple of 4 shares blocks with its neighbor.
  • Uneven grids: a sheet whose width does not divide by the column count puts cell edges between pixels.

02 // HOW TO

Fix the seams

  1. Leave a transparent border inside each cell. 2 to 4 px stops filtering; each mip level you need to survive doubles it.
  2. Keep the effect's visible content off that border at its largest frame.
  3. Use cell sizes that are powers of two, such as 128 or 256 px, so the grid divides the sheet and the compression blocks.
  4. Set the texture wrap to clamp, so the outer cells do not pull pixels from the opposite side.
  5. If seams appear only at a distance, cap the mipmap levels or fade the effect out before it gets that small.

03 // WITH SPATIAL COMPILER

Empty margins in every compile

FIREBALLFINAL
First frame of the fireball bake
Fireball, 9.4 x 13.4 m, compiled with Spatial Compiler. Spec →

Spatial Compiler frames every tile with an empty margin, 4% of the tile by default (views.margin), about 10 px on a 256 px tile. Tiles are 256 px on an 8 x 8 grid, so the 2048 x 2048 sheet divides evenly. When the effect touches the tile edge, the report your agent reads warns and names the setting to change.

05 // FAQ

Seam and bleeding questions

All questions →

README.SPRITE_SHEET_SEAMS
How much padding should I add around each sprite sheet frame?

Add 2 to 4 pixels for filtering alone. For mipmaps, double the padding for every level you need clean, such as 16 pixels.

Should particle atlases use power of two dimensions?

Yes, where you can. Power of two sheets and cells divide cleanly at every mip level and line up with compression blocks.

How do I prevent visible seams between frames in a Unity sprite sheet?

Pad the cells, set Wrap Mode to Clamp in texture import settings and check that the Texture Sheet Animation grid matches the sheet.

How do I prevent texture bleeding between frames in a Niagara sprite sheet?

Pad the cells and check that Sub Image Size matches the grid. Reduce mip levels in Mip Gen Settings if bleeding shows far away.

How do I prevent texture bleeding between frames in three.js?

Pad the cells or shrink the UV window by half a pixel on each side. Setting minFilter to THREE.LinearFilter turns off mipmaps.

Compile your first effect

You pay per compile and see the price before it runs. New accounts start with $5 of usage.

All effects, guides and explainers →