Auto-tiling is what lets you paint "grass" or "water" on a map and have the borders sort themselves out. Under the hood every auto-tile system does the same thing: look at the neighbours of a cell, turn them into a number, and use that number to pick a tile.
The two layouts you will meet most are Wang-16 and blob-47. They are not interchangeable. Picking the wrong one means either drawing tiles you never use or getting seams you cannot fix.
Wang-16: a tile per corner combination
A Wang corner set asks one question per tile corner: is this corner terrain A or terrain B? Four corners, two options each, gives 2⁴ = 16 tiles.
Each tile is identified by its corners, read clockwise or as a 4-bit number (NW, NE, SW, SE). The full grass tile is 0000, the full dirt tile is 1111, and everything in between is a transition.
Wang-16 works well for top-down terrain: grass meeting dirt, sand meeting water, snow meeting rock. Transitions are soft and diagonal-friendly, and you only draw 16 tiles per pair of terrains.
Its limit: because it only knows about corners, it cannot tell a one-tile-wide path from a thicker one. Thin features come out blobby.
Blob-47: edges and corners
A blob set looks at all 8 neighbours of a cell: the four edges (N, E, S, W) and the four corners (NE, SE, SW, NW). Eight bits would mean 256 combinations, so why only 47?
Because most corners don't matter. A corner neighbour only changes the tile if both edges next to it are also set. If the north or east neighbour is empty, the NE neighbour is hidden behind a border anyway. Fold away the corners that can't be seen and 256 masks collapse to 47 distinct tiles:
The folding rule in code is three lines:
// bits: N=1, NE=2, E=4, SE=8, S=16, SW=32, W=64, NW=128
function canonical(mask) {
const N = mask & 1, E = mask & 4, S = mask & 16, W = mask & 64
if (!(N && E)) mask &= ~2 // NE only counts with N and E
if (!(S && E)) mask &= ~8 // SE only counts with S and E
if (!(S && W)) mask &= ~32 // SW only counts with S and W
if (!(N && W)) mask &= ~128 // NW only counts with N and W
return mask
}
Run every value from 0 to 255 through it and you get exactly 47 unique results.
Blob-47 is the right choice for walls, platforms, cliffs, rivers and 1-tile-wide paths: anything where inner corners and thin strips have to look deliberate. The price is drawing 47 tiles instead of 16.
Which one should you draw?
| Wang-16 (corners) | Blob-47 (edges + corners) | |
|---|---|---|
| Tiles per terrain pair | 16 | 47 |
| Looks at | 4 corners | 8 neighbours |
| 1-tile-wide strips | Blobby | Clean |
| Inner corners | Soft | Sharp, explicit |
| Good for | Top-down ground, water, sand | Platformer terrain, walls, cliffs, roads |
| Godot 4 terrain mode | Match Corners | Match Corners and Sides |
| Tiled Wang set type | Corner | Mixed |
A common setup is both: Wang-16 for the ground layer, blob-47 for walls and anything the player collides with.
You don't have to draw 47 tiles by hand
Most blob tiles are combinations of the same few pieces: an outer corner, an inner corner, a straight edge and the fill. Split each tile into four quarters and every quarter is one of those pieces. This is the RPG Maker "A2 autotile" trick, and it means a handful of hand-drawn pieces can generate the full 47.
That's the approach the tileset editor in SimplePixelArt uses: draw a base tile, pick Wang-16 or blob-47, and it composes every border variant for you.
Getting the set into an engine
Godot 4: create a TileSet, add a terrain set with the mode from the table above, add your terrain, then paint the peering bits on each tile so they match its mask. With the bits set, the Terrains tab in the TileMap editor auto-tiles as you paint.
Tiled: open the tileset, add a Wang set of type Corner (Wang-16) or Mixed (blob-47), add your colours, and mark each tile's corners or edges. The Terrain brush then picks tiles automatically.
Marking 47 tiles by hand is the tedious part, so it's worth using a tool that writes the file for you. The tileset editor above exports a Godot .tres with the terrain peering bits already set and a Tiled .tsx with the Wang set filled in.
Summary
- Wang-16: 4 corners → 16 tiles. Soft ground transitions, cheap to draw.
- Blob-47: 8 neighbours, with hidden corners folded away → 47 tiles. Clean walls, paths and inner corners.
- Choose by what the terrain has to do, not by tile count.
If you want to try both without drawing anything first, open a free online pixel art editor, sketch one base tile and let the tileset editor build the set. There's more pixel art made with it on the site.


Top comments (3)
Nice write-up, the canonical() fold is the clearest explanation of "why 47" I've seen.
One practical gotcha with Wang-16: because it's corner-based, the terrain really lives on the vertex grid (W+1 by H+1), not on cells. If your level data stores one terrain per cell, you have to derive each corner from the four cells around it, and whether you use "any of them is dirt" or "all of them are dirt" noticeably changes how thin features and diagonals come out. Worth deciding that rule before drawing the tiles.
Related trick if anyone wants to go even cheaper: the dual-grid approach. Keep terrain per cell, but draw the visual tilemap offset by half a tile, so each drawn tile sits on four data cells. That's exactly the 16 corner cases above, and with rotation it collapses to about 5 unique drawings for one terrain pair.
Thanks! The corner rule is a really good point, and easy to miss. "Any" tends to fatten paths and merge diagonals, "all" thins them out and can drop 1-cell features completely. I usually pick per terrain: "any" for the one that should spread (water into grass), "all" for the thin one.
And yes, dual-grid is great. Five or six tiles plus rotation is hard to beat when you don't need hand-painted variety on every edge. Might be worth a follow-up post.
finally get what godot’s “match corners and sides” means lol