Development Blog‎ > ‎

Heightmaps and Landscape

posted Mar 20, 2012, 12:43 PM by Mavrik Games   [ updated Aug 13, 2013, 10:40 AM ]
I've been exploring the landscape system in UDK for the last week and a half or so, and discovered that you can import heightmap data to create a landscape. I knew about the concept of heightmaps - I read a tutorial once for XNA that created terrain from grayscale images - but the UDK uses a file format that isn't actually an image. It's called "raw 16", which is just a binary file containing a continuous string of 16-bit numbers. UDK reads the file from left to right, top to bottom and assigns each 16-bit number as the height for the "next" voxel.

I wanted to try editing a basic heightmap and importing it to UDK so I'd have a starting point for my overworld map. Well as much as I love computers, trying to edit binary files is just no fun, and even passing the file through a hex decoder just leaves you with what appears to be a hellaciously long number. I knew that heightmap data could be represented as a grayscale image, so I did a few google searches for software to convert raw files to images and vice versa, but I came up with nothing. As is usually the case when I can't find the software to do what I want, I make it! :)

After a few days, I had the HIC ready to go. It wasn't too difficult, once I understood the format of the raw files and how to convert binary data to grayscale images in C#. Well wouldn't you know it, not even a week after I uploaded the installer to this website, I found Li'l Chips Software's HMCS. I guess my google-fu is getting weak! I found that it did almost everything I needed, and even a few things I didn't. I think it was originally designed for the UDK terrain system, so it has a 513 x 513 cap on image size, and it doesn't support 8-bit layer data conversion, but it's still a really good tool. I definitely would not have gone through the trouble of writing my own tool had I known it was out there.

So if you need heightmaps bigger than 513 x 513 or if you want to create the layer alpha maps in an image file, feel free to use the HIC. If you don't need those features though, the HMCS is a tool that's had much more thought and hard work put into it, so I'd try it first.