teaching machines

L3DT tutorial 1: Creating and exporting a heightmap for Unity

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

This tutorial will show you how to create a heightmap in L3DT (Large 3D Terrain generator) and export it to use in Unity. L3DT is a great tool for mapping, because it gives you a lot more control over the terrain and generation process than Unity’s built-in editor does.

First of all, download and install L3DT (standard edition) from http://www.bundysoft.com/L3DT/.

When you launch L3DT, go to File → New Project. It will bring up this window:

Pick blank designable map if you want to create the terrain from scratch, or designable map if you want randomly generated terrain to work with. If you pick designable map, you will get a window like this:

Here you can set some parameters to define how the terrain will be generated. The features are pretty self-explanatory.

Once you are done refining those, hit next until you get a design map:

where the land tiles will appear green (hue based on height), and the water tiles will appear blue. Here, you can click edit to paint additional features onto the terrain, or double-click a specific tile:

to edit it individually. You can also refine some of the parameters from before in these windows, which can give varying types of terrain on the same map.

Once you have the design map refined, click calc. And select heightfield:

the generator will display a window showing the different steps of the heightmap generation, and then leave you on a heightmap like this:

This map will be basically the same as your design map, but the generator does average heights across tiles to simulate real terrain, so you may need to edit the heightmap itself to make sure any small features you want are still there. To do this, click the 3-D button in the second toolbar:

and then click edit heightfield in the Sapphire window:

This will give you many of the same tools available in the Unity terrain mapper, as well as a few additional ones that make the mapping process easier. The most important tools are:

Raise Brush: raises the terrain.

Lower Brush: lowers the terrain.

Set To: sets the painted area’s height to a specific altitude.

Raise To / Lower To: same as Set To, but will not lower or raise terrain (respectively). Use if you want to set a maximum or minimum height for an area, but not create a plateau.

Smooth: rounds off the painted area, to make it look, well, smoother.

Perlin Noise: The opposite of smooth, it adds noise back into the terrain.

 

After you are finished editing the heightmap, hit escape to close the Sapphire window and go to file → export → export map layer → heightfield, and click OK.

In the export map wizard, select RAW format, select a path to save the exported heightmap to, and change the width an height to 1025, 1025, and hit OK.

Congratulations, you just exported a .raw file that you can import into Unity! I will cover the importing process in the next tutorial.

 

If you want a better visualization of your map, you can again click calc, and check the rest of the boxes in the calculation queue.

After a few dialog windows (feel free to change whatever settings you want) and a couple minutes of staring at the generator, you will get a textured map:

which you can fly around by clicking 3-D again:

These textures will not be visible in Unity, since you cannot import the texture map. There is, however, a $25 tool called Tom’s Terrain Tools that will allow you to import alpha splat maps into unity to replicate L3DT’s texturing. I will not cover this here, since there are free alternatives for texturing, and I will instead show you how to use Terrain Toolkit to texture your map in my next tutorial.

Have fun!