Search Unity

Terrain Toolbox import heightmap resolution errors

Discussion in 'World Building' started by JBT27, Sep 30, 2019.

  1. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    Tiles imported into the Import Heightmap dialog, and the Tiles section, report:

    TerrainToolbox: Imported heightmap resolution is not power of two.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Well, it is actually. The menu options are not powers of two, they are powers of two plus one. I have tried tiles that are 2048 and 2049, but it throws this error every time. This on a 10km x 10km terrain.

    Or would be if it worked.
     
    LadyK77 and Cuku_ like this.
  2. Skull_Frog

    Skull_Frog

    Joined:
    Jul 18, 2017
    Posts:
    2
    I'm having the same issue, any updates?
     
  3. sky-diver

    sky-diver

    Joined:
    Jun 25, 2019
    Posts:
    1
    Same thing here - Any chance to get that get solved ...?
     
  4. cucoogames

    cucoogames

    Joined:
    Mar 24, 2020
    Posts:
    1
    +1 here and bumpedi-bump.

    I've tried different images with the resolutions 1024 and 1025 as well as 2048 and 2049, but it won't let me import them with the error given by OT.
     
  5. danramosf

    danramosf

    Joined:
    Sep 28, 2018
    Posts:
    1
    So nobody was able to solve it?
     
  6. madfu

    madfu

    Joined:
    Aug 9, 2018
    Posts:
    19
    Got this to work, pretty easily by following the info in the docs explicitly.

    That 'pretty easily' came at a price: multiple hours, over a couple of days of trial and error, including having a look at the underlying scripts. Unity really needs some better documentation for this tool.

    In my case, i was converting a terrain i'd made in Second Life years ago into a heightmap that was compatible with Unity. Here are my steps at a high-level; one shouldn't need to follow all of them.
    1. in a tool like GIMP (or other image manipulation tool) import your image in its native format.
    2. the Terrain Tool has changed its behavior a bit in this update to specify that your heightmap must be a power of 2, therefore, in your image manipulation tool make sure the RESOLUTION, NOT THE SIZE is a power of 2 (128x128, 256x256...etc). This is going to seem strange if you have used this tool in the past, where you manually had to change your heightmaps to 257x257, but this is no longer necessary, as Terrain Tool now does this for you during the process of import.
    3. ensure that your Precision or bit depth is 8-bit or 16-bit, floating point, with Perceptual Gamma sRGB. i tried both.
    4. DELETE (not just disable) all layers except the one containing your heightmap. this is only necessary for those with multiple layers in their heightmaps, as with Second Life heightmaps. i wouldn't expect this step to be necessary for normal heightmaps, but i burned several hours not groking that disable still leaves the data available in the final file (thank the Maker for Hex Fiend).
    5. export your new heightmap to .raw. if this step is completed correctly, a 256x256 px/in resolution of an image of 256x256 pixels will yield a file size of ~66KB (on a Mac).
    6. import your new heightmap into Terrain Tool like normal, making sure that your Tile Height Resolution matches your power of 2 compatible resolution +1 (257 for 256x256).
    following these steps i was able to convert a dozen or so heightmaps in about an hour, once i'd figured it out.
     
    Last edited: Oct 10, 2020
  7. trevor3

    trevor3

    Joined:
    Sep 14, 2018
    Posts:
    1
    I couldn't fix this error by changing the image size or print resolution. After many hours, I found a Gimp path that works for me and avoids the error.
    • I start with a 1024x1024 image in Gimp.
    • greyscale, 8bit, no alpha channel (Layer->Transparency->Remove Alpha Channel)
      • Removing the alpha channel is necessary. If you don't you will get an erroneous error saying that the height map resolution is out of range.
      • In my case, I just leave the print size resolution at 72 pixels/inch (not a power of 2)
    • File->Export As
      • Select File Type by Extension (end filename in ".raw")
      • RGB Save Type: Standard (R, G, B)
      • RGB Save Type: R, G, B (normal)
    • In Unity I used the Terrain Toolbox, Create New Terrain section (3.0.2-preview.3)
      • 2000x2000x300 tile with height resolution set to 1025
      • Import height resolution is also 1025
      • I put the raw file directly in the create dialogue instead of adding it after.
    • The maximum tile size is 4096x4096 (tested)
      • Common tile sizes are 512x512, 1024x1024, 2048x2048 and 4096x4096
    Hoping this helps someone.
     
    Last edited: Jun 30, 2021
    martindmn35 likes this.
  8. AtomicDust3779

    AtomicDust3779

    Joined:
    Feb 17, 2022
    Posts:
    1
    turn off compression in the inspector
     
  9. MachoBrizzin

    MachoBrizzin

    Joined:
    Jul 10, 2013
    Posts:
    27
    This doesn't do anything.

    Anybody got a different solution? Every suggestion here doesn't work for me.
     
    LadyK77 and BenJeet like this.
  10. LadyK77

    LadyK77

    Joined:
    Aug 17, 2022
    Posts:
    3
    I am so beyond frustrated with this process. I have tried every single method here and NOTHING is working.
     
    Joshua2335 likes this.
  11. LadyK77

    LadyK77

    Joined:
    Aug 17, 2022
    Posts:
    3
    Where did you find the documentation?
     
  12. LittleRegicide

    LittleRegicide

    Joined:
    Aug 21, 2022
    Posts:
    1
    I just got it to work unexpectedly. So I used the inspector to dl a 16bt .raw; then made an empty terrain and imported a raw with the same dimensions rather than using the terrain tool. idk it worked
     
  13. madfu

    madfu

    Joined:
    Aug 9, 2018
    Posts:
    19
  14. Jabaconater

    Jabaconater

    Joined:
    Mar 11, 2022
    Posts:
    2
    Is there no way to do non-square heightmaps like 4096p by 2048p?
     
  15. Joshua2335

    Joshua2335

    Joined:
    Oct 16, 2021
    Posts:
    1
    This is quite possibly the most frustrating thing i've ever done with Unity, none of these solutions work and I think i'm just gonna have to move on with my project sadly