Heightbooster - Effectively double the height of your heightmaps

I’ve always been somewhat frustrated with the natural limit of a height map’s 255 pixels of depth and how that translates to mountainous areas on Roblox. They felt small and insignificant.

The method here can be used to effectively DOUBLE the vertical size of a heightmap by turning one image into two and stacking them ontop of one another.

Where do I get it???

The Python script and requirements can be found on my Github page.

How does it work?

Using Python, we utilize the OpenCV package to read the image, and then use the Numpy package to split the image into two based on the middle point in terms of height.

We then take both images and normalize the height so that we maximize our usage of the 255 pixels of depth allocated.

Then we output the images to an output folder, and we’re done!

Any Drawbacks?

  • Currently, there is a banding effect on the top layer (but not the bottom), I believe due to the fact that the package (OpenCV) does not accept the size of some files, though I’m unsure. In any case, there is likely a fix for this, though I’m not sure how.
  • Terrain takes up a non-trivial amount of game memory, and this method will potentially double the amount of memory terrain takes up in your game. Add on a highly complex colormap and you could reach the stable size of a Roblox game relatively quickly (100 megabytes).

  • Additionally because we are using 2 separate “blocks” of terrain where we attach them together, Roblox may simplify the terrain at long ranges to where a “seam” may appear between the two layers. It’s not noticeable 98% of the time, but a consideration nonetheless.

How do I use it?

  • Assuming you have downloaded Python, start by pip installing Numpy, and OpenCV if you have not already through the requirements file on GitHub.
pip install -r requirements.txt
  • Next, take the .py file and modify the first 2 lines to specify the location of the heightmap you want to target and the directory you want the two heightmaps to go to, and save.

image

  • Run the script.

  • Take your first heightmap (lower_half.png), and import it through the terrain generator normally.

  • Next import your second heightmap (upper_half.png) with a Y offset of the Y size of your first heightmap, import, and voila!

Is this right for my game?

  • This tool is best suited to large mountains and canyons. Using open source heightmap data to pair (1:1 heightmap generator) is helpful for quickly making large terrain maps.

  • This tool is designed for large terrain, but could equally be used to add more detail to smaller maps.

  • You may lose some detail and increase the effect of banding/steps in your terrain (due to the drawback previously written), your mileage may vary.

Examples

(Below, doubled height)

(Below, normal scale heightmap)

If there are any bugs you find or improvements you have, please let me know/release to the public!

5 Likes