top of page

Procedural Landscape Generator 

DirectX 11, C++, HLSL

The Project​

My task was to use procedural generation techniques, as well as some post processing effects within the DirectX 11 framework.

 

This project uses Perlin noise along with multiple terrain altering techniques. The user can combine these in any way to generate unique landscapes.

 

Since there are many many controls, I recommend having the CONTROL LIST open while using the application

Application Features

A Perlin noise map can be altered using a variety of methods. Below are the techniques used to generate the Perlin maps in my application. Generally, a Perlin Noise function is provided with a Frequency (the scale of the map) and an Amplitude (the height value, usually clamped). This map is applied to the height value of the vertices of a flat plane, white being 1 and black being -1.

Here is the result of this Perlin map onto the terrain plane:

perlin.png
perlin1.PNG

Perlin noise maps with alternate frequencies: 

perlin.png
high freq.png

​​Smoothing:

This is a height averaging technique that smooths out vertices based on it’s neighbours. This works by finding all existing neighbours of the point, a maximum of 8 locations, and setting that point to the average height of each neighbour. 

Octaves:

Groups of Perlin noise maps with weightings for number of octaves, persistence (change in amplitude per octave) and lacunarity (change in frequency per octave). These can add layers of detail to existing maps and provide excellent results on their own.

Number of octaves:

This is number of Perlin maps combined together but results stops being noticeable around 8 octaves. Below is 1 octave compared to 6 octaves:

octave0 - single octave -png.png
octaves.png

Lacunarity:

This determines the change in frequency per octave. A higher value creates a very jagged surface:

Persistence:

This is the change in amplitude per octave:

lacunarity.png
persist.png

Octave Examples: 

3 octaves, 0.4 persistence, 5 frequency, 0.9 amplitude, 3 lacunarity

octaves1 (6 oct, 0.75 perst, 3 freq,0.44

10 octaves, 0.5 persistence, 2 frequency, 0.4 amplitude, 3 lacunarity

octaves0(10 oct, 0.5 perst, 2 freq, 0.44

Fault Lines:

This creates a random lines to cut across the terrain, lowering and raising either side of each line. 2 random points are chosen to determine the line, and the method is applied 20 iterations per key press (the 4 key) or singular line (the 3 key).

 

Since the line is a clear cut between the terrain, I recommend smoothing the terrain after the iterations. Here are some iterations before and after smoothing:

fault.PNG
fault smooth.PNG

Particle Deposition:

A single point gradually building up based on the terrain it is placed on. For example, placed on a flat terrain will create a pyramid like shape (shown), but on an existing Perlin map this technique creates a unique mountainous structure (shown).

After getting this method to work, I wanted to see the effect the reverse would have. Once applied on top of a Perlin height map and smoothed slightly, this erodes the landscape, looking similar to a deep lake or crater (shown here).

pd.PNG
inverse pd.PNG
good pd.PNG
inverse pd on island perlin.PNG

Islands (Circles Algorithm)

This uses a generated falloff map (using the equation of a circle) to create sloping circular gradient from the middle, and when combined with Perlin noise can generate island landscapes.

I also use the circles algorithm in the Random Point function, which generates random locations on the terrain and plants a small circular hill or erodes a small area (the inverse).

Circles1.png
perlin with island.PNG

Ridged noise

Using the absolute value of Perlin noise (use values between 0 & 1 instead of (-1) & 1), interesting curved lines are created where values would usually be negative. 

 

When combined another Perlin noise map and Islands this can result in ridged mountains, and the inverse of this could create grooves in the mountain (shown here).

ridge2.png
ridge1.png
ridged.PNG
perlin with inverse ridged nosie.PNG

Capped Heights

This was used on mountainous structures to cap/invert the height of the terrain above/below a defined value. This can create a volcano structures when applied on an island terrain map (shown here).

Procedural Cabbage (shown here) is made by capping between the max height value on a Perlin + island map, multiple times, which creates the procedural rings.  

volcano.PNG
procedural cabbage.PNG

Terraces 

This is an advanced capping technique, rounding the noise values with 2 weighting values to determine the step height. The effect results in a step based noise map, splitting the terrain into height regions which steps between height values instead of the usual gradient.

terraces.png
terraces.PNG

Water Plane

This was another terrain plane with a Perlin noise Map applied which increases its X and Y scale values over time, to give the effect of moving water.

water.PNG
Capture.PNG

Height Based Texturing

This is used to blend certain textures together depending on the height of the pixel compared to the height of the terrain. My terrain has 5 levels of textures, for Water, Sand, Grass, Rock and Snow. These are demonstrated in the graph here.

texturing.PNG
bottom of page