Large tiled landscape without World Machine. Short Tutorial

Just like many of the posts I have read in the past few months,I wanted a large map for my game world but didn’t want to purchase World Machine. So, I’ve been working on other parts of my game, and occasionally I come back and put some time into figuring it out…

This week I spent the last couple of days working on this and came up with a solution. It takes lots of work but can be accomplished for free.

This is a list of the basic steps I took;

  1. Acquire or make your heightmap from your preferred source. Next, we need to resize it, change the format, and cut it into pieces.

  2. Determine the overall size of the landscape as you want it after it’s done…
    Remember, if it’s over 20 km per side, you need to implement your own streaming method for multiplayer… Single-player, no problem…So It might be best to keep it under that unless you’re prepared to delve into that ball of worms.
    This is how big your heightmap needs to be in meters… So a 20km wide heightmap would need to be 20000 pixels wide…
    However, you have to take a look at the tech data page( https://docs.unrealengine.com/en-US/…ide/index.html ) for landscapes to determine which size works best for your situation. Then round off to make the division work. I wanted as close to 20km on a side as I could get, but I also wanted to have many landscapes that had free components and could be unloaded and streamed in, to make the CPU overhead as small as possible. I ended up going with 19171 pixels. That made 19-1009 meter wide landscapes as close as I could determine with 64 8x8 components each.

  3. Open in gimp, and resize to the appropriate size.

  4. Make sure to set the resolution to 16bit, and the color to grayscale. Save.

  5. Import the grid guides plugin from Github… The gimp plugin depository is closed, but they have a link to it on Github.

  6. Use grid guides to divide up your heightmap into the appropriate number of images.

  7. Go to filters<web<slice to use pyslice to cut up and save your tiles as .png to import into world composition.


  8. Rename the images to use the format that world composition needs, or it won’t import properly.
    I found that I was able to change the base name to img_X , and that helped…
    Ue4 need the images named as name _X then the xcoord, and then_Y ycoord.
    I rewrote the python code in pyslice to do this… If you attempt this, the i and j variables are backward for the naming convention.

  1. After importing into world composition many times I realized a few things.
    First, if all had to turn off" flip y" in the importer. Also, if you don’t edit pyslice, the import scrambles the order of the maps. Pyslice cuts up the pic with rows marked as x and columns as y, while ue4 is the opposite. At first, I just moved all the tiles into the correct place, but that got to be really old quickly, so I went back and edited Pyslice again.

I couldn’t figure out how to get the image to share pixels between images yet. This allows for some of the map edges to not meet exactly. So for right now, all I do is run a smoothing brush at about .02 strength over the edges to stitch the seams together. This works well, but there is also the work of smoothing the entire landscape, because even though my heightmap was over 4gb. It wasn’t high enough detail for smooth terrain. So, between stitching the seems and smoothing the terrain, there is quite a bit of work. But it can be done for free. :slight_smile:

I made this original post from my phone, so I’ll post some pics soon for examples

2 Likes

You sir, deserve kudos

Actually I decided to give a try to another idea I had to simplify further this approach. I came up with a script that slices an input file into a grid of files suitable for UE4.

I tested this with python 3.6, numpy and opencv4.
Here it is. It expects a file called “in.png” and will output in the same folder the tiled heightmap (IMG_Xx_Yy.png), all of it in 16bits.
The cool thing is that once you’ve got python and opencv, the conversion really only takes seconds.

Also the shared vertice is taken care of ! (the grid slicing has 1px of overlap).

Also: the y does not get flipped by my little script. So when you import a tiled landscape in UE4, uncheck the Y flip.

Careful though, the grid slicing has 1px of overlap, but therefore discards the last few rows and lines of pixels in the source.

3 Likes

pretty awesome

need more info like how to convert fbx height map file to use in gimp unless there is that plugin and i can not seem to find have no idea what its call

.fbx isn’t an image format…it’s a mesh format…sorry

heightmaps are images. I’ve had my best luck with .png
number 1 in my list is for you to acquire or make your heightmap from your preferred source…There are way too many ways to make a heightmap for me to delve into that.

Thanks for sharing! Great!