Godot 4 Texture Bleeding: Padding, Extrude, and the Settings That Stop It

You import a clean sprite sheet, run the game, and see a thin colored line along the character’s edge. Or a one-pixel border on every tile. The art looks fine in the image editor, so the sheet must be wrong — except it is not. The sampler is reading pixels from the neighboring frame.

This is texture bleeding, and it is one of the few problems in this pipeline with a deterministic fix.

What bleeding looks like

If the line is always on the side facing the next sprite in the atlas, it is bleeding. If the whole sprite pulses in brightness, that is flicker, not bleeding.

Why it happens

A GPU does not read a texture pixel by pixel. With bilinear filtering, it blends the sampled pixel with its neighbors. At the edge of a sprite, the “neighbor” may be the next sprite in the atlas, or the empty gutter.

Mipmaps make it worse: Godot generates smaller versions of the texture, and at those levels the neighbor is even closer. The result is a line made of the neighbor’s colors.

Three conditions create it:

  1. Frames are packed edge-to-edge (no gutter).
  2. The texture uses linear filtering.
  3. The texture has mipmaps, or is displayed at a non-integer scale.

Remove any one of them and the line usually disappears. Remove two and it is gone.

The three fixes

1. Padding

Padding adds empty space between frames in the atlas. It gives the sampler a neutral gutter instead of a neighboring sprite.

2. Extrude

Extrude repeats the sprite’s outermost pixels outward into the gutter. Instead of sampling transparent or neighbor pixels, the sampler sees the sprite’s own color.

Setting What it does Typical value
Padding Empty space between frames 2 px
Extrude Repeats edge pixels into the gutter 1 px
Filter Nearest vs linear sampling Off for pixel art
Mipmaps Smaller texture versions Off for 2D sprites

3. Filtering and mipmaps

For pixel art:

For painted art, keep Filter on, but keep Mipmaps off unless you see shimmering at distance. If you do enable mipmaps, increase padding and extrude.

Godot 4 import settings

Select the PNG in the FileSystem dock, open Import, and set:

Setting Value
Filter Off (pixel art) / On (painted)
Mipmaps Off
Compress Mode Lossless
Detect 3D Off

Click Reimport. If the sheet is already imported, changing the settings and reimporting is enough; you do not need to delete the .import file.

AtlasTexture and regions

If you use a generated .tres with one AtlasTexture per frame, the region is the frame rectangle. Padding lives outside that rectangle, in the cell. That is why the frame rect in the JSON points at the sprite, not at the padded cell.

If you slice a grid manually in Godot, the editor’s grid uses cell size including padding. Keep the two consistent: the frame data and the texture layout must agree, or the sprite will be offset by the padding amount.

Reproduce it, then fix it

A quick test scene:

  1. Import a sheet with 0 padding and Filter on.
  2. Put two neighboring frames side by side in a Sprite2D or AnimatedSprite2D.
  3. Scale the sprite to 0.75 or 1.25 (a non-integer scale).
  4. Look at the edge that faces the neighbor.

Then:

  1. Re-export with padding 2, extrude 1.
  2. Set Filter off for pixel art.
  3. Reimport and repeat.

The line should disappear. If it does not, check that the sprite is not being scaled by a fractional amount and that the atlas is not using mipmaps.

Case Padding Extrude Filter Mipmaps
Pixel art, 1× scale 2 1 Off Off
Pixel art, scaled in UI 4 1 Off Off
Painted art, 1× 2 1 On Off
Painted art, mipmaps 4 2 On On

These are starting points, not laws. The correct value is the smallest one that removes the line in your scene.

FAQ

Does padding alone fix bleeding? Usually, if Filter is off. With linear filtering, extrude helps more because it gives the sampler the sprite’s own edge pixels.

Why does the line appear only when the sprite moves? Sub-pixel positions change which texels are sampled. A static sprite may sit on exact pixels; a moving one does not.

Is this the same as flicker? No. Bleeding is a line at the edge; flicker is the whole sprite changing. They have different fixes.

Does a texture atlas need padding if the sprites never touch? Yes, because filtering can still reach into the gutter. The gutter needs to be transparent or extruded.

Can I fix it in the shader? You can clamp UVs or use texture arrays, but padding and filtering are simpler and cheaper for 2D sprites.


If the sheet itself is uneven, fix that first: Fixing uneven AI sprite sheets. If the sprite is blurry rather than lined, check the Godot SpriteFrames guide.