Editing Terrain Heightmap

So you've made your terrain and ended up with one that is too small for your project. You've probably tried altering the terrain and changing the terrain tile but the only thing that happens is that it gets resized.
Don't worry this is completely fixable by just following these simple steps.

IMPORTANT NOTE: MAKE A COPY OF YOUR LEVEL BEFORE MODIFYING IT IN CASE SOMETHING GOES WRONG.



Edit Terrain Heightmap


Export the current height map of the level


Note: tested only with single tile terrain. (TODO)

1. Locate the hires terrain folder and find CTerrainTileComponent0 under the Scene tab of the right-panel.
hires terrain > tile 000x000 > tile 000x000 > tile 000x000 > CTerrainTileComponent0

2. Right click on the THIRD CBitmapTexture (the third one is the heightmap of the terrain). Click on Export file.

3. Save the heightmap as a DDS - it is the only texture format that works.

Edit the heightmap


1. Open the newly saved .dds file in Adobe Photoshop with the Nvidia Texture Tools plugin installed.

Note: GIMP should work too since it has a DDS importer. (TODO: test it)

2. Create a new layer and use the Bucket tool to fill it with a black color (hexcode: #000000).

3. Resize the canvas to the target size of the new level. The size needs to be power of two + 1.
Example: if you had a 257-sized level, to double it's size you would need to resize the canvas to 513. That's power of two (512) + 1 = 513. This is important!

4. Fill the newly created white canvas with black and merge the layers together. (The reason we created a new layer instead to just paint black to the heightmap was to avoid destroying any data on the height map itself.)

5. Save your heightmap in the DDS format, and save it as a 32f R 32 bpp | floating point file.

Note: no other file format will work, and saving in one of the other floating points formats will cause your height map to be bunked up once you import it.

Modify your terrain in REDkit


Now you will have to modify your current terrain to fit the new heightmap and get the extra space.

1. Open the terrain tool and click on Create/modify terrain, and on the Size case in world units, type your target canvas size. Click on Modify terrain to complete the process.
Example: with the aforementioned example, the size would be 513.

2. Open up the Modify tab under Terrain tools. Change the modification tool to modify tile parameters. Then click on the terrain with the newly tool choosen and you will get a popup window. Ignore Diffuse and Mask map resolution, and change the Texture Resolution to your canvas size (example: 513) and click on OK.

3. Once again locate the third CBitmapTexture, but this time when you right-click it choose Import and locate your modified height map.

4. Lastly choose the Smooth modification tool in the Terrain tools and set Outside Radius to 500 and Intensity to 0, now simply click once on the terrain and everything will be back to normal state.

That's it, you now have a larger terrain and can continue working on your project!

Video tutorial


EditingTerrainHeightmap from mikael nordkvist on Vimeo.



Additional note


In case you can't get GIMP to work and don't have Adobe Photoshop, simply email your exported heightmap to tekoppar<at>gmail.com with the desired size and I will fix the heightmap for you.