Godot 4 can add a source to a TileSet you already have open. It cannot take two .tres TileSet resources and give you a third. Drop yours here and get one file with every terrain in it — ids renumbered, layers deduped, and the new terrain and source numbers listed so the maps you already painted can be fixed. Nothing is uploaded.
.tres TileSets hereSave it into your project in a folder where every texture the table above lists resolves — the merged file keeps each atlas's path exactly as its own file wrote it. Then open it once in the editor so the Terrains tab picks up the new set.
A .tres TileSet is a header, a list of [ext_resource] textures, a list of [sub_resource] atlases and one [resource] block that points at them by id. Putting two of them in one file looks like a copy-and-paste job, and it is — until you notice that the ids are not unique across files.
Every TileSet written by the same tool tends to use the same id. Every file in our own free starter pack calls its atlas TileSetAtlasSource_bsmith. Paste two of them together and sources/0 and sources/1 both resolve to the last atlas declared:
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_bsmith"] # grass
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_bsmith"] # stone — same id
[resource]
sources/0 = SubResource("TileSetAtlasSource_bsmith") # stone
sources/1 = SubResource("TileSetAtlasSource_bsmith") # stone again
Godot 4.3 and 4.7 both load that file with no error and no warning. The TileSet has two sources, the source count is right, the editor opens it — and one of your two terrains is gone, painted over by the other. That is the failure this page exists to prevent, and it is checked, not assumed: test/tres-merge.test.js builds exactly that hand merge, loads it in both engines, and asserts that both sources come back pointing at the same texture.
| Thing | What happens to it |
|---|---|
| Sub-resource ids | Renumbered per file (_f0, _f1, …), always — even when they would not have collided. |
| External textures | The same path in two files is one [ext_resource]; different paths stay separate. |
| Terrain sets | Sets that share a mode are combined, so their terrains can be painted next to each other. Two sets from the same file are never merged — that separation was the author's decision. |
| Terrains | Appended in file order and renumbered; every tile that referred to one is rewritten to the new index. |
| Physics / navigation / occlusion layers | Two layers with an identical definition become one; layers that differ are appended, and the tiles of the later file are moved onto the new indices. |
| Custom data layers | Same rule, plus a check: two layers with the same name and different types is a refusal, because get_custom_data() could not tell them apart. |
| Properties this tool does not know | Carried through from the first file that declared them, byte-identical. A disagreement is reported, never resolved silently. |
A refusal produces no file at all. The merge stops when the files describe grids that cannot share one resource — a different tile_size, tile_shape, tile_layout, tile_offset_axis or uv_clipping — when a file is not a Godot 4 TileSet, or when a custom data layer name means two different types. A Godot 3 format=2 file is refused with a pointer to the converter, which is the step that comes first.
This is the part a merged file cannot tell you itself, and the reason the report above exists. A TileMapLayer does not store the atlas's name in a cell — it stores the source id, and terrain painting stores the terrain index. Merging changes both for every file after the first.
So if you already have a scene painted with the second tileset, the merged resource will draw the wrong tiles until its cells are renumbered. The report lists the old and new numbers for each file. Fixing an existing layer is a loop over its used cells:
for cell in layer.get_used_cells():
if layer.get_cell_source_id(cell) == OLD_SOURCE_ID:
layer.set_cell(cell, NEW_SOURCE_ID, layer.get_cell_atlas_coords(cell))
Atlas coordinates do not change, so a cell keeps the same tile inside its atlas. If you have not painted anything yet, none of this applies — merge first and paint after.
Nothing here is specific to our files: any two Godot 4 TileSets merge. But if you do not have two to hand, these do:
.tres files with their textures, one terrain each, in four themes and two layouts. They are the reason this page exists..tres back, one terrain at a time.A merged TileSet gives you several terrains in one resource. Whether a tile of one terrain sits correctly next to a tile of another is a question about the 47 tiles of a blob layout, not about the merge — the terrain matcher can only see across terrains that are in the same set, which is exactly what merging by mode gives it.