Generate and edit a landscape

The goal of this tutorial is to explain the basics of the landscape generation ; we will see how to generate and spawn a fully procedural landscape from a blueprint.

A simple landscape.

The basics.

In this first step, we will generate a rather simple landscape using only a Perlin noise to generate the terrain heightmap.

So, the first step is to create a landscape generator blueprint.

The landscape generator blueprint is an editor blueprint that will be executed from the editor. When opened (double-click or right-click Edit LandscapeGenerator), we see an event-graph with one event On Execute Landscape Generator: the nodes connected to this event will describe the landscape generation process.

Now we’re ready to start. And it’s really simple: we just call the method Spawn Landscape, and given that we want to use a Perlin noise to generate the landscape, we put the Perlin noise in the Module pin.

Then we right-click on the blueprint and click the Execute option.

After a few seconds, the landscape is generated.

As we can see, this landscape is pretty flat. But if we increase the Perlin frequency to 5, we get more interesting results.

Using only a Perlin noise won’t allow us to create a great variety of terrains, nor realistic ones. However, playing with noises functions we can get nice landscapes. Here’s a small example of what you can achieve (with less repetition than the raw Perlin):

The parameters.

So far, we’ve just quickly seen how to generate a landscape but didn’t focus on the generation parameters. Let’s have a look on what we have for the Spawn Landscape node:

The return value is a landscape object.

Setting the weightmap.

You can manually set the weightmap of your landscape using a array of heights.

You need to use the ConstructStatic function from the noise library. This static module can be filled with a Texture2DInitializer or a ManualInitializer. Have a look at the NoiseLibrary documentation page for more informations.

In the following example, a 256*256 landscape is generated using random values put in the NoiseMap array variable.

Making a tiled landscape.

Making a tiled landscape is useful for very large landscapes: it will build a grid of several landscapes which connect seamlessly. It’s really simple to use, the only difference is that we won’t call Spawn Landscape but Spawn Tiled Landscape.

Most of the parameters are common with the Spawn Landscape node. The major change is the new parameters: Tiles Count X and Tiles Count Y. They specify the the number of tiles we want along the X axis and along the Y axis. The size of each tile will be given by the landscape size parameters.

The return value is a meta-landscape object.

Editing a landscape.

It’s also possible to edit an existing landscape. The Edit Existing Landscape function won’t spawn a new landscape actor, but instead will edit the landscape passed in the Landscape parameter, and will apply to it the given Module with the given Module Height Multiplier.