Independent Learning: Heightmaps Unity

Independent Learning: Heightmaps Unity


My independent learning is how to use height maps in unity. Bare in mind that there is more to height maps though this is what I learned when trying to use it for my final project. So height maps are essentially gradient (most often greyscale) type maps that you can convert to a 3D model. In terms of 3D, the lighter the grey is the higher the map goes. Sharp edges will create a cliff like form in 3D and areas with a slow gradient transition between while and black create hill/mountain like terrain. Basically if you using Unity, height maps are useful of creating believable terrains or real world environments. Height maps can be imported to almost all 3D programs that utilize some form of terrain feature, this includes Blender, Maya, and Unity. This can be easily achieved through photoshop using the cloud effect filter to create a believable grey scale image. You can probably find a height map of Australia in google and recreate the terrain using the map to look like the actual continent in Unity.

The process of using height maps for Unity is a little tricky. Obviously there are a lot of tutorials about it I will be linking to some of them that I used at the end of this blogspot.  These are the different steps that I go through to achieve my Mount Everest terrain in Unity.

  1. Go to terrain,party (google it if you need), highlight an area of your choosing, you can also type in the location that you want to download the height map.
  2. Once you have the location, click on the cloud with the download symbol to get a zip file of the height maps.
  3. There are at least five height map files that you get from the zipped file. Select the one that says "(Merged).png" and import it into photoshop.
  4. This step is where it gets tricky in photoshop, under image, set the mode to greyscale (DO NOT save it in RGB) and save the file as photoshop raw.
    1. When the photoshop raw options is up, if you see "Save Channels In" DO NOT save it, that means you have layers that needs to be merged with the "background".
      1. If you do when you the file into unity terrain you will get a very stretched mesh that looks like a weird design sculpture from the 50s.
  5. After exporting it in RAW file, go to Unity start a scene and add a terrain mesh to your scene.
  6. In inspector for terrain  you will see a cogwheel near the terrain brush tool, click on it the import bar would appear in inspector.
  7. Import the RAW file in, and your terrain is modelled similar to the height map that you downloaded.
    1. If you feel that the terrain is still too stretched you can change the height of the terrain to your liking.
  8. After that the only step is to smooth out the surfaces as some of the areas of the terrain are very jagged and have pot holes.
  9. When finished start adding in terrain textures and models in.

Bare in mind that I only know how to use height maps in a terrain mesh. Now these are the steps that I went through to get my Mount Everest terrain. There are a lot easier ways such as Geolocation, especially for a common environment but overall I feel that it looks exact the same as what the mountain looked like in real life. The problems that I had were the ones where my terrain was stretched because I exported the RAW file the wrong way, or having strange terrain cliffs which looks as if the textures are being pulled into the group.

In Maya its a different story. You can use the height map feature in the brush tool of maya and for all meshes. However I would recommend using the plane mesh because if you use the cube mesh the when importing the map half of the map will cover the top and the other will cover the bottom. In addition you have to set your bush size to the size that is shown in the video that I would link in the bottom. If you feel that terrain looks too smooth bump up the intensity percentage until it looks like the terrain that you want. In addition if you want to create a miniature version of a location and the geo location mapping in SketchUp isn't big enough for your project, then you can use height maps along with bump maps. The thing that you need to pay attention is matching both files together so that they look believable.

There are other ways to make it easier, although some you would need to download a certain asset in order to upload a height map into Unity without difficulty.

Here are the links to the tutorials that help me with using height maps.

Unity Height Map tutorial: https://www.youtube.com/watch?v=VLTBYmmvLus

Maya Height maps tutorial:https://www.youtube.com/watch?v=c6y3C0y64bA&t=132s

No related post

COMMENTS

LEAVE A REPLY

Your email address will not be published. Required fields are marked *