Unity Terrain from Heightmaps

Terrain is used in game development as the environment that the game will take place in. it defines the details of the landscape like elevation, textures, engine drawing, tiling etc.

Heightmaps are a piece of data that terrain can use to define the shape of terrain.

When used together, they can create quick easy terrain.

Maple Tools

The equator website has the option to export terrain as a .raw file, engines like unity can interpret this file and create a heightmap which defines the height of the landscape at any given point. This is what we will be using for the tutorial today.

Creating Unity Terrain With Super Accurate Real World Data

Equator export tool

How to I use the export tool?

After going to maps.equatorstudios.com you can navigate to the site builder tab where you will need to define an area for the export by selecting “Edit Site Bounds”. Clicking places a point and dragging will make a line, use this to make a box around the data you want

Step by step can be found at Exporting Topography but you will export a heightmap in .raw format

How do I make a unity project?

Assuming you have unity installed from https://unity.com/ you can use the Unity hub to make a new by selecting New->3D.

Create a Unity project
Terrain Heightmap importing

how do I import the terrain?

You can import the .raw file by selecting Assets->Import New Asset. Alternatively you can just drag the .raw file into the assets folder.

How do I create a terrain object in Unity?

To create a new Terrain Object we go to GameObject -> 3D Object -> Terrain

Now what?

Now we will apply our heightmap (.raw) to the terrain.

We do this by going to the terrain settings under the Terrain component and under “Texture Resolutions” we hit “Import Raw”.

Finally we set the X and Z to our height and width of the file we downloaded before, and hit import.

Note: you can adjust the Y size to get more impact from the terrain.

Can I play?

To make a basic playable game, Download the asset at the link below. You can import the asset into Unity under Window->Package Manager. Once imported, bring in a car prefab, I recommend the Utility vehicle due to a potentially bumpy ride!

Get The Asset Here!

Make a simple Unity game

Unity Terrain from Heightmaps Conclusion

Looking for more game development posts? We should be coming up with some new content in a bit, stay tuned!