teaching machines

L3DT Tutorial 2 and Terrain Toolkit Tutorial 1: Importing your heightmap into Unity

December 2, 2012 by . Filed under fall 2012, honors 304.503, postmortems.

Importing your .raw file into Unity is not a very complicated process. First, create a terrain object in Unity:

Click Terrain → import heightmap – RAW, and select your .raw file from L3DT.

In this import window, you can set the size of your terrain, but more importantly you can set the import parameters. Chose Bit16, 1025×1025, and Windows for the Depth, Width, Height, and Byte Order, and click import. You will get a terrain map like this:

If you want to make the map a little flatter, you can click Terrain → Set Resolution, and change the height there.

To texture your map, you can use Unity’s built-in texturing tools, or you can use Terrain Toolkit to set the textures procedurally. To do this, download Terrain Toolkit (http://code.google.com/p/unityterraintoolkit/downloads/list) and run the Unity package file. This will import the Terrain Toolkit into the project you have open. Then, in the project window, go to TerrainToolkit and drag the TerrainToolkit C# file onto your terrain object.

Now select the terrain and, in the inspector window, you can change the slope where the cliff texture is displayed, and change the heights where the textures you selected are displayed. After you have everything set, click apply procedural texture to texture the map:

On this map, I just used contrasting textures to show how the textures are applied. When you use actual terrain textures, it looks a bit more like this:

And that’s all there is to it. Feel free to email me with any questions, and happy mapping!