Creating terrain heightmap

Started by K3rhos · 10 months ago · 4 replies · 703 views

#1
K3rhos
Member
JoinedJul 2023 Posts58 Score680
S&box can be really "unpredictable" sometimes when importing an heightmap, if you've made a small mistake in the export format, or if you kept an alpha channel active, or using the wrong precision format, you will end up with a complete mess on your terrain and it's probably gonna leaves you frustrated about why it doesn't work as intended !

So here is the steps if you wanna create one (I'm using GIMP so idk about the steps on Photoshop, so if anyone knows, feels free to leave a comment !)

- Open GIMP
- Create a power of two texture (512x512 as an example, this is important, I personally recommend a 4096x4096 texture if you want enough details)
- Then make yourself an heightmap (by drawing) or import one (You can create an heightmap by going "Filters" > "Generic" > "Heightmap")
- Set the mode to "Grayscale" (Go to "Image" > "Mode")
- Set the precision to "16bits integer" (Go to "Image" > "Precision")
- Disable colors management (Go to "Image" > "Colors management")
- Make sure to remove the Alpha channel (if there is one) by right clicking on your layer and select "Remove alpha channel" (This is super important)

The file should then be exported as .raw format, make sure to leave the export settings to default. (Otherwise it will not work properly)

My original gist post: https://gist.github.com/K3rhos/5d72302e14c6a8acd48a701c9affe482
#2
Titanovsky
Member
JoinedSep 2021 Posts324 Score3,973
oh, thanks!
#3
The Impastabowl™ at Olive Gard
Member
JoinedNov 2025 Posts6 Score6,452
important post
edited 8 months ago#4
GONGONG
Member
JoinedFeb 2025 Posts8 Score470
I have no knowledge of heightmaps nor have I ever used GIMP as of this post. I followed these instructions blindly and had the following notes to add for others who want to have a go at making their heightmaps.

I had trouble finding some of the settings after downloading GIMP version 3.0.6 so this is where I found some of the settings after some searching:
  1. I was unable to find "Heightmap" in "Filters" > "Generic" > "Heightmap" so I went with "Filters" > "Map" > "Bump Map"
  2. I couldn't find "16bits integer" under "Image" > "Precision". I found this in "Image" > "Encoding"
  3. I couldn't find  "Disable colors management"  under "Image" > "Colors management". I found this in "Edit" > "Preferences" > "Color Management" > "Image display mode"
After configuring the settings, I made this drawing in GIMP using the paintbrush tool:
Using "Export As", I found the file type of "Raw image data" with the extensions of "data" and "raw'. It exported the file with the extension ".data". I changed the extension to ".raw" in file browser and imported the heightmap to my terrain in s&box editor. This yielded me with the below results in my terrain:

For a first go at this, thank you for the instructions. I will now try to tweak the heightmap to make more solid mountains.
Any tips on how to make more solid mountains opposed to the rough terrain I created?

#5
Pulldown
Member
JoinedFeb 2023 Posts1 Score260
Just tried following this guide, worked on a couple images I found online but if you attempt to make a height map from scratch make sure you are setting the advanced resolution, not just image size. Maybe a given for some but took me a minute to figure out. (Screenshots in GIMP 3.0.6)
In advanced options you can set the true resolution.
Hope this helps! 
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.