Landscape - Importing Heightmap results in extreme terracing

I have used several programs that import heightmaps, a couple of them game engines and 3D visualization software (like VUE). No program I’ve ever used has had this effect

From far away the terrain that was imported looks fine:

However if I zoom in closer, we see the landscape has imported very strangely:

My question is what causes this, and how to make UE4 interpolate the heightmap?

If this is just the way it imports then here is another question. Due to limitations in how many variations there are within a typical gray-scale PNG image, I designed a format for a heightmap using multiple colors for precision:

Red channel: Represents 1 unit
Green Channel: Each green unit represents 1/256’th of a Red unit.
Blue Channel: Each blue unit represents 1/256’th of a Green unit.

I’ve used this format before and it’s extremely easy to implement the code to export and import this map, the problem is I can’t find any location to add custom import scripting, short of completely modifying the engine, is there any support for adding in custom heightmap formats, or plugins that add this type of support? This really only matters if I can’t import the normal heightmaps smoothly.

looks like an 8 bit heightmap was used, the recommended format is .raw16.
also your getting warped edges from not using the correct size

I know about the warped edges. No program I can find supports saving to .raw16. I find it a little strange that something as large as the Unreal Engine doesn’t supply good support for the most common type of heightmap on the internet. I’ve exported as 8, 16, 24, 32 and 48 bit PNG images and all of them have the same terracing effect. Can you explain why a format which I’ve never heard about (and I’ve dealt with heightmaps for around 7 years) is the only format that generates good terrain?

As for the size, I’m using a script I wrote using the diamond fractal subdivision method, the algorithm only works on sized that fit 2^x + 1 on both dimensions, which simply doesn’t work with unreal by default, I threw this one to get a screenshot, typically I crop the image to scale.

sorry, so used to writing in shorthand, .raw16 = .raw @ 16bit

Height Map Formats

When exporting heightmaps from external programs, only the following formats are usable inside UE4.

16-bit, grayscale PNG file.
16-bit, grayscale .RAW file in little-endian byte order.

Except that no program I can find exports to 16-bit anything, I’ve used Photoshop, Paint.NET, GIMP, and a dozen other programs. The only “raw” type available on any of them is “.data” . What program am I supposed to use to get this mysterious format? Spending the entire day trying to figure out heightmaps, typically one of the easiest parts of making a map, it slightly annoying.

Edit, managed to finally export a 16-bit RAW file from photoshop, but it still didn’t work, same exact thing happened… I’m really getting annoyed at this, such a simple feature made extremely complicated for some dumb reason.

What source program did you use to make the heightmap? Because my guess is it wasn’t exported in 16 bit in the first place so it doesn’t matter how many times you resave it from Photoshop.

It’s not an obtuse format at all, Epic is using it because it gives you a far greater range and accuracy. My guess is other programs you used interpolated the results. 16 bit greyscale will give you 65,000 shades instead of 256 8 bit. Which is awesome for fine details and features with scale.

It’s a script I wrote to generate preceedural data from a diamond fractal using midpoint displacement. My current implementation is actually in javascript and I don’t know how to display a 16-bit greyscale image on the canvas, or how to save as one from the algorithm. The map is generated using plain data, with several thousand units in range min to max and including decimals so plenty of potential for precision formats such as 16-bit. I plan on writing the algorithm on a different language, but haven’t done so yet.

If it’s not possible to implement via javascript, I can either rewrite it sooner (have a reason to do so) or create an intermediate program that takes forsay the red and green bytes and combines those together for the 16 bits, then I just adjust the export to have R = Math.floor(value / 256) and G = value % 256;

I know that 16-bit ranges 0 - 65535 while 8 bit ranges 0-255, just don’t understand how to write that format.

Edit: 16-bit greyscale appears from documentation that it should be easy to implement in most languages, so I can probably figure that out, any info would be helpful if there is any, but I’ll report back if I can or can’t get it working.

well i had the same problem and eventually found an open source terrain editor called scape, i’ll post the link below.

with this program you can make entire terrains from scratch, but you can also import images and then just use the editor to export out to .raw16 or .png16.

hope this helps, can’t for the life of me figure out why gimp doesn’t support 16bit but with this you should be able to workaround :wink:

cheers

http://www.decarpentier.nl/scape

1 Like

It may be using quite a lot of memory to render that landscape, I got this “awesome” side effect when I had too many assets loading in memory

I fixed my issue by increasing my texture streaming pool size in ConsoleVariables.ini to half my video cards memory (2GB)
C:\Program Files (x86)\Epic Games\4.10\Engine\Config

Put this anywhere in that file r.Streaming.PoolSize=****

Edit: try importing at half the resolution and see if that corrects it, also see if smoothing the landscape gets rid of the “Voxelized” terrain, might help you diagnose your problem

Ok, I’m now getting this issue, only happening with 4.11 using heightmaps that I’ve used in 4.10 and below, stuck building grass to when using a terrain material with grassmaps, memory usuage in-editor is only 1.8GB.

Edit: Forgot I had my engine settings on minimum from my last project where I was stress testing, to fix your issue change textures to Epic

Photoshop does, of course, work with and save to 16 bit greyscale images that can be successfully used as a heightmap. Scape is nice but it was never finished. There are a lot of terrain generators and editors around, L3DT is one of them (http://www.bundysoft.com/news/doku.php?id=l3dt:2016:mar:28), TerreSculptor is another one (Page Redirection) but imo the best one is World Machine (http://www.world-machine.com/). In my game classes we use World Machine which is a node based generator with a somewhat steep learning curve but it gives good results.

Of course by now we all know that World Machine exports to 16 bit RAW files…

So, after struggling with this myself for quite a while, and not having luck with any other reply, I finally found a solution to this, for absolutely free (many of the solutions on this post require too much money or hassle for someone who only needed to make these height-maps once or twice).

GIMP’s development build 2.9.4 finally has an option for 16-bit operations. So, I’m going to assume that you have an 8-bit PNG (or any bit) and want to convert to 16. Do the following:

  • Open GIMP 2.9.4
  • Open your image
  • Select Image -> Mode -> Grayscale
  • Select Image -> Precision -> 16-bit integer
  • If your image was an 8-bit image, you may want to do a quick Filters → Blur → Gaussian Blur… to add more accuracy to the image
  • Hit “Convert”
  • File → Export As…
  • Set your settings, and export.

It’s pointless to go down the path of trying a free trial for WorldEditor or Photoshop when the downloads are so large and time-consuming. And GIMP is much more known than some of the other off-known back-of-the-internet image converters that one finds trying to do 16-bit operations.

GIMP 2.9.4 download page:
https://download.gimp.org/mirror/pub/gimp/v2.9/