Importing terrain using an heightmap generated from an stl file

Hello everyone,

I’m trying to import a terrain into Unity using a heightmap, but I’m encountering an issue where the imported terrain appears flattened compared to the original 3D mesh. Here’s the workflow I followed:

  1. I originally created the terrain as a 3D mesh in Rhino and exported it as an STL file.
  2. To import it into Unity as a terrain, I converted the STL into a PNG heightmap using this tool (STL2PNG - javascript edition), choosing a standard resolution of 1024.
  3. I then imported the PNG as a heightmap in Unity’s Terrain tool.

When comparing the Unity terrain to the original mesh (which I converted to OBJ to display in Unity), I noticed that the Unity terrain is significantly flatter than the original model. I suspect this is due to certain parameters in Unity’s terrain settings that I may be setting incorrectly.

Could someone guide me on which settings in Unity’s Terrain tool I should adjust to get the heightmap to accurately represent the original terrain’s elevation? I tried tweaking several options, but nothing seems to correct the flattening effect.

Thank you in advance for any tips!


There is a “Terrain Height” parameter in the terrain settings, under “Mesh Resolution”. However, I don’t know what the correct setting would be to get the same height. By the way, how are you using a PNG as heightmap? You can only import RAW, as far as I’m aware, and it looks like the heightmap is compressed to a lower bit depth, probably from 16 to 8, resulting in visible steps in the terrain.

Thanks for your help! I ended up fixing the issue using this tutorial to create my heightmap in Blender: https://www.youtube.com/watch?v=arvhK4tvYuY.

Initially, it didn’t work because part of the model was below the zero level. After some frustration, I realized I just needed to move the entire model above zero, as shown in the second picture. And boom—problem solved! :blush: