- Home /
How to make a terrain height map without photoshop?
So i’m following a tutorial for Unity which requires creating a height map using an image editor. As you know, Unity exports the terrain height map as a .raw file, and requires a .raw file to be imported as well. I’ve been trying for the past 90 minutes to get this to work. Here’s what I tried so far… (I am using Mac OSX)
First, I tried importing it into Gimp. This did not work, because Gimp does not appear to support .raw files.
I downloaded UFRaw plugin for Gimp. The plugin was a zip file which contained 75 files, mostly C scripts. According to the instructions for installing Gimp plugins (here: https://en.wikibooks.org/wiki/GIMP/Installing_Plugins#Mac) I simply copy those files to the /Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts/ directory. I did so and restarted Gimp, but it still did not accept terrain.raw.
I downloaded RawTherapee and installed it. RawTherapee, for whatever reason, does not recognize the terrain.raw file. I’ve tried right clicking the file and using “open with” and selecting RawTherapee, and I’ve also tried navigating to the file within RawTherapee - in both cases, the file is not recognized.
I tried converting the .raw file to a .jpeg via https://raw.pics.io/ but the website did not recognize terrain.raw.
I downloaded and installed Fiji, which finally opened terrain.raw. I exported it as a .tiff file so that I could open it in Gimp and create a height map - finally some success! But then, of course, Gimp could not save it as a .raw, only .data. I tried exporting the .data and importing that into Unity, no success. I even tried re-naming it to a .raw (just to see if it was an arbitrary naming issue), but when I imported that into Unity it came out flat, without any height.
So I’m not usually one to go and ask questions online before I’ve tried a lot, but I feel like I’ve done my due diligence on this one. Can someone tell me how you can edit and import a height map into Unity without Photoshop? At this point I feel like I’ve tried every suggestion I’ve read on the web - using Gimp, using a Gimp plugin, using a raw-to-tiff converter, using an online converter, etc. Nothing seems to be working.
Any help would be greatly appreciated!
Answer by longpinkytoes · Mar 06, 2018 at 03:40 AM
i have the same question, although GIMP 2.9.8 (2017-12-12) supports exporting to 16-bit raw format. it can now export as .data rgb planar, and import that file back into gimp as gray unsigned little- or big- endian.
supplementary: darktable purports to be a full-featured non-destructive raw image manipulation program, although the semantics of game engine vocabulary means this is the wrong kind of raw.
maybe some light on the matter:
https://sozvyezdami.wordpress.com/2015/05/13/on-unity-5-game-engine-heightmaps-photoshop-imagemagick-linux-etc/ [imagemagick has had gray 16-bit little/big endian capability for ten years, since 2008]
So. To sum up.
Unity 5 Game Engine Heightmaps use the “Photoshopy” RAW image format, which is not a standard at all.
You can convert PNG, JPEG, etc images to 16 bit grayscale in a Photoshop style RAW heightmap format using the Image$$anonymous$$agick conversion program named “convert”. You need to put the suffix ‘.gray’ on your output file and the ‘-depth 16’ flag on the command.
You may have to play with the Byte Order on the Unity import window
Thanks from here too. I was trying to do it with The Gimp but I didn't found a proper way. Imagemagick's convert did the trick perfectly. :D
Could you share the command line you use to convert images to raw so that Unity can import it?
So far: I had no success with the following:
$ convert TestMap.png -depth 16 test.gray
$ convert TestMap.png -depth 16 -endian LSB test.gray
$ convert TestMap.png -depth 16 -endian MSB test.gray
$ convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org Features: Cipher DPC Modules OpenMP Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
Thank you for the response! I can't recall how I got around this now, it was so long ago, but I'll be needing to do some terrain work again soon so this is really helpful.
Answer by Invertex · May 17, 2017 at 11:12 AM
You don't need to save it back out as RAW. You managed to import it into GIMP, so that's what matters. What you want to export it back out as is a 16 or 32bit format that Unity can import, such a TIFF.
To my limited knowledge terrain object doesn't import tiff. which is why the question refers to importing raw. I know that Photoshop works but pricey. Terrain Importer on the asset store imports ter(terraland), tif, tiff, raw 8 & 16 bit and world machine r16, r32. And will to boot flip your images vertical, horizontal or both together rotates 180 degrees. $10 would get you version 1.4, ask him nicely and he may upgrade you to ver 2.
Answer by manfredfrisch · Sep 06, 2021 at 10:42 AM
Here is a small tool I wrote to convert image files (e.g. png) to raw files compatible with Unity:
Your answer

Follow this Question
Related Questions
How do importing image when game is running (Run Time) ???? 0 Answers
About Heightmaps 1 Answer
How do I import a picture, from a standalone application, to be displayed on a texture of some kind? 1 Answer
Loading image from external directory at runtime 0 Answers
Blurry Textures, despite High Detail! 2 Answers