Unity Terrain
How to make a heightmap for Unity Terrain
Unity imports terrain from a 16-bit RAW file whose size is a power of two plus one. Here is how to make one in your browser, which import settings to use, and the two mistakes that cause a flat or flipped terrain.
Free, no account, nothing uploaded. Needs a WebGPU browser: Chrome, Edge, or Safari 26+.
Step by step
From blank terrain to Unity Terrain in six steps
- Set the real size first. Select the terrain in Spirelight and set its width, depth and height in the inspector. These are metres, and they end up in the numbers you type into Unity, so a 2000 × 2000 m terrain that is 300 m tall should be set up that way before you export.
- Make the shape. Double-click the terrain to open the Terrain Editor. Roll a base shape in Generate (mountains, rolling hills, mesas & canyons or dunes), then use the Shape tools (rain erosion, terraces, plateaus, island edges) and the brushes to finish it. The 3D preview is the same path-traced renderer used for pictures, so you can judge how the slopes catch the light.
- Pick the resolution. The editor works at 256, 512, 1024 or 2048. Unity wants 2n+1 samples, so Spirelight resamples on export to 513, 1025 or 2049, whichever keeps your detail.
- Export the RAW. Choose File › Export for game engine (or Export for game engine… in the Terrain Editor). Under Heightmap, click RAW 16-bit and pick the size from the dropdown next to it. The dialog header shows the terrain's size, for example 2048 × 2048 · 2000 m × 2000 m, 300 m high. Write those three numbers down.
- Import in Unity. Create a terrain with GameObject › 3D Object › Terrain, open Terrain Settings, then Import Raw… and pick the file.
- Enter the import settings exactly as below, then press Import.
The import dialog is where most problems happen, so here are the values to use:
| Unity field | Value | Why |
|---|---|---|
| Depth | Bit 16 | The file is 16-bit; 8-bit would read it as noise. |
| Resolution | The size you exported (513, 1025 or 2049) | Unity needs this to find the row length. |
| Byte Order | Windows | The file is little-endian. Mac byte order makes the terrain spiky. |
| Flip Vertically | Off | Rows are written south-first, which is what Unity expects. |
| Terrain Size | Width, height and length from the export dialog | Without these Unity keeps its default 1000 × 600 × 1000. |
Why these sizes
Why 513, 1025 and 2049?
A Unity terrain stores one height per grid point, and the grid is a power of two plus one so the edges of neighbouring tiles line up. 513, 1025 and 2049 are the common choices (Unity also accepts 129, 257 and 4097). A bigger heightmap costs memory and build time without making a distant mountain look any better, so match the size to how close the player will get.
Spirelight exports the RAW with 16 bits per sample, 65,536 height steps, so a gentle 300 m slope stays smooth. That is the main reason to use RAW or a 16-bit PNG instead of an ordinary 8-bit image, which would show visible steps. The longer story is in the heightmap generator guide.
If your own terrain is much wider than it is tall, remember that the heightmap only stores relative height. The metres per pixel come from the width you type in Unity: a 2049-sample RAW over 2000 m has samples about 0.98 m apart, which is plenty of detail for ridges but not for rocks and paths. Use Unity's detail tools or textures for that scale.
What is free
The free route, and what Pro adds
The RAW heightmap, the 16-bit PNG, a normal map and glTF or OBJ meshes up to 512 × 512 vertices are free, with no account. Free exports are for personal use. For a game you sell you need Pro's commercial-use licence (licence terms), which is $6 a month, $48 a year or $99 once.
Pro adds the Unity pack: one zip that resamples the heightmap to the right size for you and includes:
- a README with the exact Import Raw values for your terrain, and a
scale.jsonwith metres per pixel and the height range; - a splat map and four greyscale masks (grass, rock, snow, sand) worked out from slope, height, water level and ridges;
- an editor script (Tools › Spirelight › Apply Splat Map) that paints the splat map onto four Terrain Layers;
- an OpenGL (Y+) normal map for custom shaders.
The full engine walk-through, with the same settings for Unreal and Godot, is on Terrain for Unity, Unreal and Godot.
Troubleshooting
When the terrain looks wrong
- Spiky, jagged mountains. Byte order is set to Mac. Re-import with Windows.
- A flat plain with a few odd bumps. Depth is 8-bit, or the resolution field doesn't match the file. The file size should equal resolution × resolution × 2 bytes.
- The terrain is mirrored. Flip Vertically was switched on. It should be off.
- It is tiny or very tall. The Terrain Size fields were left at their defaults. Type the width, height and length from the dialog.
- Visible steps on slopes. You exported an 8-bit image somewhere in the chain. Stay with 16-bit RAW or PNG throughout.
Not sure about the shape? Turn the sun low in the editor. Raking light shows banding, flat tops and odd seams much better than a head-on view. If you outgrow single terrains, Gaea, World Machine and World Creator build tiled worlds; see the Gaea alternative guide for how they fit together.
Questions
Unity heightmap questions
What heightmap size does Unity Terrain need?
A power of two plus one: 513, 1025 or 2049 (129, 257 and 4097 also work). Spirelight resamples its 256 to 2048 terrain to 513, 1025 or 2049 when you export a RAW.
Should I use RAW or PNG for Unity?
RAW. Unity's Import Raw reads 16-bit RAW directly. A 16-bit PNG needs a conversion step, while an 8-bit PNG loses precision and shows terraces.
Is the Unity heightmap export free?
Yes. The 16-bit RAW, the 16-bit PNG, the normal map and meshes up to 512 × 512 are free and need no account. Free exports are for personal use; commercial games need Pro. The one-click Unity pack with splat maps is part of Pro.
Why is my imported terrain flipped or mirrored?
Leave Flip Vertically off. Spirelight writes the RAW with rows south-first, the order Unity's importer expects.
Can I import a heightmap from Gaea or World Machine into Spirelight first?
Yes. Use Import image… in the Terrain Editor with a 16-bit PNG, light and check it, then export the RAW for Unity. Non-square images are cropped to a centered square.
Keep reading
Your terrain, ready for Unity.
Open the editor, double-click the mountains, then File › Export for game engine.