Gridwright Store

28 Nov 2026 · By Gridwright Studio

Lines Between Tiles: How to Fix Texture Bleeding in Godot and Unity

Gridwright pack artwork for Lines Between Tiles: How to Fix Texture Bleeding in Godot and Unity

You paint a field of grass, press play, and thin lines show up between the tiles. Some sit on every tile edge. Others flash for one frame while the camera moves, often in the colour of another tile in your tileset. That colour is the clue: the GPU read a pixel from outside the tile, from whatever sits beside it in the image. This is texture bleeding, and a few settings decide whether it happens.

We measured it in Godot 4.7.2. The test atlas is a 48x48 image with one green 16x16 tile in the middle, magenta tiles round it and a transparent row below. A TileMapLayer of the green tile fills a 320x180 view (stretch mode viewport) while the camera pans 0.12 px right and 0.05 px down per frame. For each setup we read back 90 frames and counted every pixel that wasn't green. The Unity and Tiled parts come from their manuals.

How to tell bleeding from a gap

  • With Nearest filtering, every wrong pixel was magenta, the colour of the tile beside ours in the image.
  • With Linear, the bottom edge, whose neighbour in the image was transparent, gave a see-through line with our blue background in it.
  • No run showed a real gap: with texture padding on, not one background pixel came through.

A line in the colour of another tile, or a faint see-through seam, is bleeding, and it comes from one of four causes.

Cause 1: Linear filtering

As Unity's manual puts it, bilinear filtering uses a weighted average of the four nearest texels. At a tile's edge, two of those belong to the next tile in the image. With Linear on and Godot's Use Texture Padding off, every one of the 90 frames had a line on every tile edge: 32 lines a frame at zoom 1, up to 33 at zoom 1.37.

Godot 4.7.2 still defaults to Linear for canvas textures (we read the setting's default from the engine). For pixel art, set Project Settings, Rendering, Textures, Canvas Textures, Default Texture Filter to Nearest, or Texture Filter on the TileMapLayer.

Cause 2: sub-pixel cameras and zoom levels

Nearest takes one texel, so it shouldn't mix in a neighbour, yet it did on a few frames. When a tile edge lands right on the border between two screen pixels, rounding can pick the texel just outside the tile. With padding off:

  • Camera moving in whole pixels: 0 of 90 frames.
  • Panning 0.12 px a frame at zoom 1: 1 of 90 frames, with a line along every row of tiles. The camera stood at y = 101.4993, a hair from a half pixel.
  • Zoom 1.37: 13 frames. Zoom 1.5: 1 frame with 13 lines. Zoom 0.5: 1 frame with 22 lines.
  • Stretch mode canvas_items, which draws at the window's size: 4 frames at 3.125x, 1 at 4x.

90 frames is a second and a half at 60 fps, so a single bad frame is a brief flash that a screenshot rarely catches.

Cause 3: mipmaps

Mipmaps are smaller copies of the texture for when the camera zooms out. Each copy averages blocks of pixels, so a tile blends with its neighbours in the image. With mipmaps, Linear Mipmap filtering and padding off at zoom 0.3, all 90 frames had lines, up to 127 in one frame. A 1 px extruded edge in the image didn't help (up to 126).

Godot imports textures without mipmaps by default, and its import docs say that in 2D they should only be enabled if the project visibly benefits. For a pixel art tileset, leave them off.

Cause 4: an atlas packed edge to edge

The first three causes need a different pixel right beside the tile in the image, and in a tileset packed edge to edge that pixel is always another tile. Give each tile a border in its own colours and a sample that slips one texel out still lands on the right colour. The engine can add the border at runtime (Godot's texture padding, Unity's Sprite Atlas padding), or the image can carry it as extruded edges.

We tested the image version too: a 1 px ring repeating the tile's edge pixels, padding off. Nearest at zoom 1.37 and Linear at zoom 1 both gave 0 frames with lines.

A top-down 16x16 pixel art map from the Top-Down Tileset: a dirt crossroads, a stone floor with barrels and a campfire, a pond with sand banks, autumn trees and a raised grass plateau
Top-Down Tileset: autotiled grass, dirt, sand and water, with cliffs and props, on a strict 16x16 grid.

The fix in Godot 4

  • Leave Use Texture Padding on in every atlas source of your TileSet. It is on by default, and the class reference says it avoids a common artifact where lines appear between tiles. With it on we saw 0 wrong pixels in every run: Nearest at zoom 0.5, 1, 1.37 and 1.5, Linear at 1 and 1.37, canvas_items at 3.125x, and mipmaps at 0.5 and 0.3.
  • Use the Nearest filter and no mipmaps for tileset images.
  • If your image already has room round the tiles, set Margins and Separation on the atlas source to match.
  • Snap 2D Transforms to Pixel (Rendering, 2D, Snap) also cleared our padding-off runs at zoom 1 and 1.37, but it shakes a player followed by a smoothed Camera2D; see pixel art camera jitter in Godot 4.

We read back the padded texture Godot builds. Our 48x48 atlas became 54x54, one extra pixel on each side of every tile, and those pixels copy the tile's own edge (the docs' TileSet page calls it a transparent edge). The padded copy had no mipmap levels, so at zoom 0.3 there was nothing smaller to blend from.

Padding only exists in a TileSet. Tiles drawn as Sprite2D nodes with a region of the atlas matched the padding-off runs exactly: 1 bad frame at zoom 1, 13 at zoom 1.37, every frame with Linear. For sprites cut from a packed sheet, use an image with extruded edges.

The fix in Unity

From the Unity 6.6 manual pages on sprite atlases and the Pixel Perfect Camera:

  • On the tileset texture, set Filter Mode to Point (under Advanced) and Compression to None. Give every sprite the same Pixels Per Unit; for 16x16 tiles in 1-unit cells, 16 makes each tile fill its cell.
  • Pack the tiles into a Sprite Atlas. Its Padding is the number of pixels Unity leaves between sprites to keep one sprite's pixels out of the next, 4 by default.
  • Set the atlas's own Filter Mode and Compression to Point and None as well, and keep Generate Mip Maps off.
  • Add a Pixel Perfect Camera (part of the Universal 2D template in URP) with Asset Pixels Per Unit matching your sprites and Reference Resolution at your game's size, such as 320x180. Its Grid Snapping offers Pixel Snapping, which aligns sprites to the pixel grid, or Upscale Render Texture, which draws at the reference resolution and scales up.

The fix in Tiled

Tiled doesn't draw your game, so the lines appear in the engine that renders the map. Tiled's job is to describe the image. A tileset based on an image supports a margin round the tiles and spacing between them, and the manual names images that have extruded the border pixels of each tile to avoid color bleeding as one use. With 1 px extruded on every side, set margin 1 and spacing 2 in the tileset's image parameters; the .tsx carries them to importers, and in Godot they are Margins and Separation.

If your tiles are in a picture of a map, the Tileset Extractor cuts it on its grid, keeps every unique tile once and saves a tileset PNG with the columns, margin and spacing you choose. Tick Extrude the edges 1 px and each tile's edge is copied 1 px out, with the margin and spacing (at least 1 and 2) written into the Tiled .tsx and the Godot 4 TileSet it saves.

A side-view level from the Platformer Tileset: grass ground with a water pit, floating dirt and wood platforms, coins, gems, spikes and a stone tower with a ladder
Platformer Tileset: grass, stone, platforms, water and props on a 16x16 grid, with day and dusk parallax layers.

Tilesets and a checklist

The Top-Down Tileset has 1,113 tiles and props on a strict 16x16 grid, as single PNGs (ready for a Unity Sprite Atlas) and as sheets at 1x, 2x and 3x (ready for a Godot TileSet with padding on). The Platformer Tileset has 285 pieces on the same grid and the Dungeon Tileset 284, each with the neighbour bitmask in its autotile file names and tiles.json.

  • A line in another tile's colour is bleeding.
  • Godot: Use Texture Padding on, Nearest, no mipmaps; extruded images for Sprite2D tiles.
  • Unity: Point, Compression None, a Sprite Atlas with padding, a Pixel Perfect Camera.
  • Tiled: an extruded image, with margin and spacing to match.
  • Test with the camera panning slowly at every zoom you ship. One bad frame in 90 hides in a still.

Our tilesets can go in commercial games but can't be resold as files; see can I use game assets in a commercial game. Packs listed since 2026-10-28 ask for a credit, "Art by Gridwright", with a link; these three are older and need none. If you need a tileset drawn for your game, you can order a custom pack.

Found it useful? Share it

Get the art for your game

Our packs together in the $20 Megabundle, a custom pack drawn for your game, or the packs in this post from $9.99 each.

Best value

Gridwright Megabundle

Our packs and tools on itch.io in one bundle, for less than three of them one by one.

Get it for $20 (opens in a new tab)

Custom packs from $49

Not finding it? We draw it for your game, in 14 days or your money back.

Order a custom pack

Packs mentioned

Related guides