Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Importing a RAW file as a Heightmap

Discussion in 'General Graphics' started by Sean-Powell, Feb 10, 2018.

  1. Sean-Powell

    Sean-Powell

    Joined:
    Dec 18, 2014
    Posts:
    87
    I was following this unity tutorial https://unity3d.com/learn/tutorials/topics/graphics/terrain-introduction-heightmaps and when exporting the raw file from Photoshop the options from Photoshop are IMB or Macintosh where as in the latest version of Photoshop the options are Interleaved and Non-Interleaved. Can someone explain which one is which now so i can correctly import the raw height data into unity as at the moment it is importing in a corrupted manner in either windows or mac mode.

    EDIT: I managed to get it to work in a sort of way via exporting in Non-Interleaved and importing with the mac settings
     
    Last edited: Feb 10, 2018
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Interleaved/non-interleaved options only show up with color images, and heightmaps must be grayscale.

    --Eric
     
  3. DerrickMoore

    DerrickMoore

    Joined:
    Feb 4, 2018
    Posts:
    246
    the must be grayscale, and 8 bit, no alpha channel, and there's a max size, around 4096x4097ish.. don't quote me on the size

    your best bet is gonna be set the height to 60-100, no higher, imo... (you only got 255 levels to work with).. so any higher and you get a curropted mass of spikes.. also.. be careful of 45 degree angles, keep in mind the meshform the terrain is being set into, made out of, etc

    use photoshop RAW files, but, you don't have to... any 8 bit greyscale image format seems to work fine... but try to use a RAW file if you can..

    I love making terrains and maps, so I got lots of little tricks I can use... like, going over to the USGS and getting some of their publicaly available digital topology maps
     
    Last edited: Feb 11, 2018
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not 8-bit. I mean, it would work, but is very poor quality. Use 16-bit. And yes, you have to use RAW, since anything else is limited to 8-bit (which, as I mentioned, is bad).

    --Eric
     
  5. DerrickMoore

    DerrickMoore

    Joined:
    Feb 4, 2018
    Posts:
    246
    nice I didn't know 16 bit would work, thanks Eric
     
  6. SalvoM88

    SalvoM88

    Joined:
    Aug 18, 2018
    Posts:
    2
    Hi all, I have another issue linked to the heightmap files on a Mac. I'm trying to import a 1081x1081 exported by Gimp as RAW (.data)extension 8bit and 16bit Greyscale, but I'm unable to import on Unity, once I click on Import RAW button in Tools terrain I cannot select any file, I've tried png, raw, psd, tiff. Are there default settings that have to match with the file I want to import to set in Terrain Resolution? like (Detail Resolution, Control Texture, Base Texture and so on).
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    1081x1081 isn't power of 2 + 1. You can only use power of 2 + 1.

    --Eric
     
  8. SalvoM88

    SalvoM88

    Joined:
    Aug 18, 2018
    Posts:
    2
    I tried to modify 512x512, 1024x1024, it didn't work, basically unity cannot select (to import) raw data from Gimp. I solved using photoshop, thanks anyway.
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not power of 2. Power of 2 + 1.

    --Eric
     
  10. Neogene

    Neogene

    Joined:
    Dec 29, 2010
    Posts:
    93
    Hi all, studying book of dead i tried to export the ground height map (raw export option when selecting the terrain), reported size on export dialog is 1025*1025 which is strange (due to the power of two rule) 16bit and windows bye order, does anyone noticed this?

    Opening with photoshop displayed 1025*1025, i had to change size to 1024*1024, 1 channel, windows byte order 16 bit, otherwise it didn't open it.
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nope. 1025x1025 (power of 2 + 1, as mentioned repeatedly), opens in Photoshop fine. Unity won't let you use anything other than power of 2 + 1; if you force Photoshop to load it as power of 2, it will load after complaining but is messed up. Byte order isn't really important since Photoshop will open both, and the terminology is silly (should be little-endian and big endian; Macs haven't used big-endian CPUs in over a decade).

    --Eric
     
  12. Janne-L

    Janne-L

    Joined:
    Mar 18, 2018
    Posts:
    12
    You can if you want(and have it) use cities skylines and its map editor.

    First you import the png etc.

    then you export the map as raw.

    Works
     
    r3dlazer likes this.
  13. amarkham

    amarkham

    Joined:
    Feb 21, 2017
    Posts:
    5
    Last edited: Oct 20, 2020
    Vict0r3znov and DerrickMoore like this.
  14. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Hello, i'd have a good use for this but i'm far too much of a beginner to quite understand how i'm supposed to use this.
    I installed python with pip and installed unity-raw-to-exr but have no idea how to actually operate this software. If at all possible could the readme be updated to have slightly more beginner friendly instructions for people that aren't used to python programs.
     
  15. fromtravis

    fromtravis

    Joined:
    May 10, 2020
    Posts:
    1
    hi All,
    oddly enough when I select "Import Raw" from the Terrain inspector, the folder window doesn't even list my raw files.
    the Raw file has been created from a terrain.party Heightmap file converted to .raw with Gimp.

    any idea ?

    thanks !