Workers & Resources: Soviet Republic

Workers & Resources: Soviet Republic

Not enough ratings
How to make a heightmap using L3DT
By Waldemar
This tutorial describes the process of making a terrain heightmap using L3DT (a terrain generation program).
   
Award
Favorite
Favorited
Unfavorite
1. Introduction
Have you tried making a map? Had a hard time finding a location that fit your idea? Frustrated by the "terraces" that you have to manually fix? Say no more! After reading this tutorial, you will be making your worlds exactly how you imagined them, and wont have to fix anything yourself! The process is rather simple, so lets get into it!
2. Required Software
The process requires two pieces of software, both free to use:
  • L3DT. It is used to generate the heightmap. Available for download here[www.bundysoft.com]
  • Heightmap Converter. A handy little tool used to convert the heightmap to a format readable by the game. From now on referred to as the converter. Available for download here[drive.google.com]
Proceed to install L3DT, and unpack the converter. Thats it! They are both ready for use.
3. Using L3DT to make a heightmap
Start up the L3DT. You will be greeted by "Ready" at the center of the program.
Follow those steps precisely:
  • Click on File -> New project
  • Choose blank designable map and click Next
  • Set width and height to 2048 (all the way to the right)
  • Set horizontal scale to 1 (the second notch from the left on the slider), and click Next
  • The HF/FM ratio defines how much control you have over the design of the map. The default option of 64 is recommended. Click on OK to proceed with designing your map.
Next up is actually designing your map. In L3DT this is achieved using a Desing map, which is coarse representation of your map, which you draw yourself.
  • Set the brush settings to what you see below. Precise explanation on all of them is available here[www.bundysoft.com]
  • Start drawing your mountains and hills. You can use Ctrl-Z to undo your changes. Do not use negative altitudes. Do not attempt to make rivers or lakes, we will make them in the game itself. After you are done, it will look something like this:
  • Click on Operations -> Calculation wizard. Make sure the Heightfield is checked, and proceed to click Next
  • Now wait for the program to generate your actual heightmap. This can take anywhere from 1 to 5 minutes
Here is your heightmap, but before we use it, we need to modify it a bit, to make it work with the game's limitations.
  • Click on Operations -> Heightfield -> Clip heightfield
  • Set it Clip below 0m to height 0m, and click OK.
  • Click on Operations -> Heightfield -> Edit heightfield in 3D. This will open a new window with a 3D representation of your world. Do not worry if your hills look like Mount Everest, this has no effects on your final map.
  • In the Heightfield tools window, click on "Set to", and in the next dialog, set the Height to -35.
  • Navigate your way to a flat area, and make a hole using the brush. Use the left mouse button to look around, and WSAD to move.
  • Close the window with 3D rendering of your world.
Thats it! Your heightmap is ready for exporting and conversion.
4. Exporting and conversion
L3DT does not support exporting the heightmap in a format which will work (good) in the game. Therefore we need to convert it using the converter, which was made by me.
  • Making sure you have the heightmap tab selected (you see the heightmap on your screen), click on File -> Export -> Export active map layer.
  • Set the file format to XYZ
  • Set the file name to what you wish, and click OK.
  • Make sure that a file with the same name but with format .dds does not exist in the folder you are doing this, as it will not be overwritten.
  • Drag your xyz file over the converter exe, like you would drag a file into the bin.
  • The converter will do its job, it can take up to minute or two.
  • The converted heightmap will appear, and you will be able to look at it if you have paint.net or Gimp installed. You can open it, but do not modify it using these programs, as this will ruin it.
Thats it! The heightmap is ready to be imported into the game.
5. Importing into the game and making water
Importing into the game is easy, and for my own sanity I assume you already know how to do it.
Making water isnt too hard either, use the brushes in terrain editor to make rivers, lakes and shores. Pay attention to the limit option, it is useful for keeping level.
6. Questions and anwsers
Some questions I thought might come across your mind reading this.

Q: Why cant we make rivers in L3DT?
A: L3DT has limitations of its own, and so does the game. Unfortunately, I didnt find anything better than making the rivers in-game. If you think of something let me know.

Q: Why cant we just use the .png export option in L3DT?
A: Doing so will work, but it will produce those ugly terraces that you have to fix by hand. You will also have to manually flip the heightmap and add 2 pixel black border to avoid the glitching borders.
7. R32F dds specification
For the technically inclined, this is the specification of the R32F dds format.
The file begins with 33 DWORDs (32 bit unsigned int), which specify the format and size of the image.
Programming Guide for DDS[docs.microsoft.com] by Microsoft
For WSRS, the header is as follows:
uint32_t header[] = {0x20534444, 0x0000007c, 0x00001007, 0x00000800, 0x00000800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x00000020, 0x00000004, 0x00000072, 0x0, 0x0, 0x0, 0x0, 0x0, 0x00001000, 0x0, 0x0, 0x0, 0x0, 0x0};

Right after the header is the data, in our case 2048^2 32 bit floats.
Useful site to understand floats[evanw.github.io]
Their range is as follows:
0.0f (0x00000000) is the lowest value, in our case its the -35m hole we made. If not for the hole, 0m would be the lowest value, and it would be impossible to make rivers or lakes.
1.0f (0x3F800000) is the highest value.
1 Comments
CaseyJones 24 Sep, 2023 @ 7:34pm 
Thanks so much for this. The guide and converter are much appreciated.