askvity

How do I export terrain height map from Unity?

Published in Unity Terrain 2 mins read

The most straightforward way to export a heightmap from Unity is to use the built-in "Export Heightmaps" tool. This allows you to save your terrain's height data as a RAW file.

Here's how to do it:

  1. Select your Terrain object: In the Unity editor's Hierarchy window, select the Terrain object you want to export the heightmap from.

  2. Access the Terrain Settings: In the Inspector window, locate the Terrain component. Click the "Terrain Settings" icon (it looks like a gear).

  3. Export Heightmap: At the bottom of the Terrain Settings, you'll find the "Export Heightmap..." button. Click this button.

  4. Choose a Save Location: A file dialog will appear, prompting you to choose a location on your computer to save the heightmap. Choose a directory and give the file a name.

  5. Save as RAW: The heightmap will be saved as a .raw file. Unity primarily supports the RAW file format for heightmaps.

Important Considerations:

  • RAW Format: The RAW format is a simple, uncompressed format that stores the height data as a grid of values.
  • Resolution: The resolution of the exported heightmap will match the resolution of your terrain's heightmap data. This resolution is determined by the "Heightmap Resolution" setting within the Terrain Settings.
  • Bit Depth: The bit depth of the RAW file also depends on the settings of your terrain and Unity version. Usually is 16-bit.
  • Other Software: You can then import this RAW file into other terrain editing software or use it for other purposes that require heightmap data.
  • Multiple Terrains: Export Heightmaps tool allows you to export height data from multiple Terrain into textures, and provides some additional settings.
  • Texture format: Unity currently only supports the RAW file format for heightmaps.

Related Articles