47-tile blob autotile bitmask table

Every 8-neighbour mask that survives the blob reduction, with the cell where our 12x4 sheet stores it. A plain HTML table: it works without JavaScript.

8-neighbour masks

For each terrain cell, look at its eight neighbours and add a weight for each one that is also terrain: N = 1, NE = 2, E = 4, SE = 8, S = 16, SW = 32, W = 64, NW = 128. The sum (0 to 255) is the mask. A cell with no neighbours is mask 0; a cell surrounded on all sides is mask 255. Cells outside the map count as empty.

Why 256 cases become 47

A corner neighbour only changes the look of a tile when both edge neighbours next to it are present. If N or E is empty, the NE bit cannot be seen, so masks that differ only in such a hidden corner draw the same tile. Clearing every corner bit that is not backed by both of its adjacent edges maps all 256 masks onto 47 distinct results. That is the blob set, also described in general terms under tile-based games on Wikipedia.

In our generator, bitmaskToCell applies this reduction, so you may look up any raw mask from 0 to 255 and get one of the 47 cells below.

Sheet layout

The autotile sheet is 192x64 pixels: 12 columns by 4 rows of 16x16 tiles. The index is row * 12 + column. The 47 tiles fill indices 0 to 46 in ascending order of mask; the last cell (column 11, row 3) is empty.

IndexMaskColumnRow
0000
1110
2420
3530
4740
51650
61760
72070
82180
92390
1028100
1129110
123101
136411
146521
156831
166941
177151
188061
198171
208481
218591
2287101
2392111
249302
259512
2611222
2711332
2811642
2911752
3011962
3112472
3212582
3312792
34193102
35197112
3619903
3720913
3821323
3921533
4022143
4122353
4224163
4324573
4424783
4525393
46255103

Mapping the sheet in your engine

These are general steps for the three common tools. We have not tested our sheets in these engines, and menu names can differ between versions, so check the official documentation of your version.

Godot 4: terrain sets

  1. Import the PNG with filtering off (Nearest) so the pixels stay sharp.
  2. Create a TileSet with tile size 16x16 and add the sheet as an atlas source; create the tiles from the atlas, skipping the empty last cell.
  3. In the TileSet, add a Terrain Set in Match Corners and Sides mode, add a terrain, and set the terrain on every tile.
  4. For each tile, mark the terrain bits that are terrain according to its mask in the table above (edge bits for N, E, S, W and corner bits for NE, SE, SW, NW). The tile at mask 0 has no bits set; mask 255 has all of them.
  5. Paint with the terrain tool of the TileMap and Godot picks the tile from the bits.

Tiled: terrain and Wang sets

  1. Create a tileset from the image with tile width and height 16 and 12 columns.
  2. Add a Wang set (or a terrain set in versions with terrains) of the corner-and-edge type with one colour for the terrain.
  3. For each tile, assign the colour to the edges and corners that its mask says are terrain; leave the others empty.
  4. Use the terrain brush on a tile layer to paint.

Unity: rule tiles

  1. Import the PNG with Filter Mode Point (no filter), Sprite Mode Multiple and a 16 pixels per unit setting that matches your grid; slice by cell size 16x16.
  2. Create a Rule Tile (from the 2D Tilemap Extras package) and add one rule per tile, with the sprite of that cell.
  3. In each rule's 3x3 neighbour grid, mark the neighbours that are terrain with the green arrow and the empty ones with the red cross, following the mask bits in the table.
  4. Because corners are ignored when an adjacent edge is empty, set those corner positions to "not specified" in the rules, or list every mask explicitly.

The same table is shipped as bitmask_table.csv inside the packs; see the packs page. For a neutral overview of tile maps, see tilemaps on MDN.