Autotiler – Blob47 auto-tiling for Tilemap


This one has it baked into a 256-entry table. The table is checkable rather than merely claimed. ... The two agree on every entry. ... TRY IT BEFORE YOU READ ANYTHING ... ALSO IN THE BOX


by Rasterloom


Price History +

Point it at a terrain sheet, press two buttons, and every edge, corner and inside corner resolves itself from the neighbours. You author nothing.

Two runtime scripts, three editor scripts, two demo sheets, three documents. Full C# source, nothing obfuscated, no DLLs.

No package dependencies in the shipped code. The tile uses only Unity's built-in tilemap module; the editor window additionally uses the 2D Sprite package that every 2D project already has. Nothing is added to your manifest.

Slicing goes through ISpriteEditorDataProvider and registers each rect in the name-to-file-id table, so re-slicing a sheet does not detach sprite references already placed in a scene.

Fill variants for the fully-surrounded case are picked by a hash of cell position, so open ground varies without shimmering while you paint and looks the same after a scene reload.

Collider type is handed straight to the tilemap collider. Tint colour per tile.

The lookup table is public and static: read it from your own generator, level importer or runtime map builder.

Documentation includes the bit layout, the corner rule, the 47 masks written out, and the one layering rule that stops an auto-tiled map looking broken.

Unity 6000.0 or newer, built and tested on 6000.6. The tile and the table work unchanged on 2022.3 and 2023; the slicing button uses an API those versions also have, but it has not been tested there.

Auto-tiling for Unity's Tilemap, without authoring 47 rules by hand.


Drop a terrain sheet into the Autotiler window, press Slice sheet and Create Auto Tile, and you have a tile you can paint with. Edges, outside corners and inside corners resolve themselves from the eight neighbours of each cell.


- - -


IT IS NOT A RULE TILE


A rule tile walks a list of rules for every cell on every refresh and stops at the first match, so its cost grows with the number of rules you authored - and you author them by hand, 47 of them, before anything appears on screen. This resolves a cell with one array read:


mask = N | NE<<1 | E<<2 | SE<<3 | S<<4 | SW<<5 | W<<6 | NW<<7

sprite = sprites[table[mask]]


No branching, no corner logic to get wrong, nothing to author.


- - -


WHY 47 AND NOT 256


Eight neighbours give 256 arrangements but only 47 distinct appearances, because a diagonal only counts when both orthogonals beside it are present: with nothing to the north it makes no difference whether something sits to the north-east - that corner is an outside corner either way. Most auto-tilers rediscover that rule at runtime, per tile, per refresh. This one has it baked into a 256-entry table.


The table is checkable rather than merely claimed. The window has a Verify lookup table button that recomputes all 256 entries from the rule and compares them with the shipped table. The build checks it the other way round as well, against an implementation that evaluates terrain shape across a whole map with no bitmask anywhere. The two agree on every entry.


- - -


TERRAINS THAT MEET FLUSH, OR KEEP THEIR EDGE



Put the path tile in the grass tile's "also counts as mine" list and the grass tile in the path tile's, and where the two meet neither draws an edge: the join reads as one continuous piece of ground that happens to change material.


Leave the lists empty, put them on separate tilemaps, and stone over grass keeps its own complete outline - which is what an outcrop should look like. The demo builds both maps side by side so you can see the difference before you commit to either.


- - -


IT FIXES THE IMPORT SETTINGS



Four settings decide whether an auto-tiled map looks right and none of them is the default: compression off (block compression puts colour artefacts along the one-pixel edge where two tiles meet, and a tile edge is nothing but edge), mip maps off, mesh type Full Rect (Tight trims transparent border pixels and the map develops hairline gaps), extrude zero. Slice sheet sets all four.


- - -


TRY IT BEFORE YOU READ ANYTHING



Window > Rasterloom > Build Autotiler Demo slices the two bundled sheets, builds two tiles and paints two working maps in your open scene. Nothing is placed by hand, and it runs the same code path your own sheets go through - so if it produces a correct map, the tool works on your Unity version, and if it does not you know inside a minute instead of after an evening of setup.


- - -


ALSO IN THE BOX



Two layouts: Blob47 (eight neighbours, 47 sprites, 8 by 6) and Edges16 (four neighbours, 16 sprites, 4 by 4).


Fill variants for the fully-surrounded case, picked by a hash of cell position, so open ground varies without shimmering while you paint.


Two 32 px terrain sheets, grass and stone, under the same licence as the rest, so there is something to paint with from the first minute.


A procedural generator that already knows its neighbourhood can skip the tilemap entirely and call AutoTile.IndexForMask(mask8) directly.


- - -


WHAT THIS DOES NOT DO



It is not a replacement for Unity's Tilemap - it adds to it, so your Tile Palette, tilemap collider and everything you have already built keep working. It does not paint prefabs, it is not a level editor, it does not import or export map formats, and it does not generate colliders of its own. If you need a full tilemap system, this is not it. This is the smaller thing: terrain that resolves itself, on the tilemap you already have.