top of page

Procedural Landscape Generator

DirectX 11, C++

Available at: 

github_PNG58.png

This project’s aim was to produce a finished application that utilised both procedural techniques and algorithms to create a realistic looking terrain. Developed using C++ in Visual Studio 2017, the application further makes use of the provided DirectX11 framework and ImGUI API. The application begins by rendering a flat plane mesh. The user is then provided the ability to manipulate the mesh by applying multiple procedural techniques. This can be achieved via controls that are provided within the ImGUI window.

Perlin Noise

This application alters the Terrain Mesh by making use of a 2D Perlin Noise algorithm. This works by passing in the co-ordinates at the point on the plane, these values are multiplied by a frequency and scale value. The returned value from the Perlin Noise function is then multiple by an amplitude value. By multiplying the point by these values, this allows the user more control over the creation and look of the terrain.

Perlin Noise Frequency 0.31 and Amplitud
Perlin Noise.PNG

Fractional Brownian Motion

Fractional Brownian Motion (fBm) is a technique that makes use of the Perlin Noise algorithm to generate more realistic and detailed terrain. It works by adding multiple layers of Perlin Noise on top of each other, while doubling the frequency and the halving the amplitude between each octave.

Octaves:
An increase in the amount of octaves will increase the amount of Perlin Noise layers added to the one position. One octave is equivalent to just one Perlin Noise pass on the position.

Amplitude and Frequency:
Employed to create more detailed and realistic terrain. When using the Fractional Brownian Motion function, the user is encouraged to use a higher amplitude and lower frequency to create a realistic looking terrain. As the frequency is doubled and amplitude is halved, finer detail is added to the terrain in the higher octaves.

Fractional Brownian Motion Octaves 13 Am
Brownian Motion.PNG

Rigid Noise

Rigid Noise is a technique that uses the Perlin Noise algorithm. Created by finding the absolute of the Perlin Noise value, making all negative values positive, and subtracting it from 1. By getting the inverse of these ridges on the mesh, more realistic terrain can be created. This Rigid Noise value will be added onto the height maps current value, allowing the user to increase the level of detail of the heightmap.

Terracing

A terracing effect can be created via an already created height map. This technique results in the height map displaying a more step-based difference between values instead of a gradient. To create this effect the height map value is rounded by using the floor function, this value is then divided by a value between 0.1 and 1 to give a different step value. This value can be changed with a slider in the ImGui window.

Terracing.png

Faultline Algorithm

Implementation of the FaultLine Algorithm was an added technique to allow more ‘realistic’ geological features to be applied to the Terrain Mesh when combined with multiple methods. To begin, 2 random points on the terrain mesh are used to build a vector. The function then loops through every position on the terrain, creating a vector between this position and the first random point. The cross product of these two vectors can then be calculated. This result will be negative for all points on one side, positive on the 

Multiple Faults.png

other and 0 when the point falls upon the line. If the outcomes y component was positive, then a pre-calculated height was added to the position's height map value 

Terrain Smoothing

First, the terrain smoothing produces a copy of the height map that has been created. Each point on the terrain is looped over and the average of its Moore Neighbourhood (in total eight surrounding points) is calculated. This calculated value is then saved to the copy of the heightmap. This is to stop the next few loops using an already altered result to create their new average result.

Thermal Erosion

The algorithm simulates a method of erosion that can be seen in the real world. Erosion results in organic material (sediment) breaking down and coming away from the side of a mountain/cliff and being deposited further down the slope. The height difference between all these points are then checked to determine if it is greater than the Talus angle, the angle at which sediment is deposited. If the difference is greater than the Talus angle then this value is added to the total difference. All eight values are also compared to

determine which point has the greatest value, this value is then saved to be utilised within the calculation that determines how the sediment would be deposited.

Redistribution

The redistribution function is used to create valley like terrain. This function is only used to alter already created height maps. The algorithm works by looping through each position on the terrain mesh, at each point the absolute value of the height map value is taken. This value is then raised to a power. If the power is greater than one then the higher points are increase and the lower points are lowered towards zero. By applying this method first with a higher value then a lower value it creates interesting terrain

Redistribution.PNG

Slope Based texturing

The aim of this technique was to blend the texture depending on the steepness of mesh at every point on the height map.  

Grass, dirt and rock textures which will be blended together depending on the slop value that is calculated. The ultimate aim was to elicit a grass and dirt blend

where the mesh was flat, a rocky texture where the mesh had a large slope and a mix of dirt and rock textures when in-between.

Slope Based Texturing.png

Water

There is a second plane mesh in the application that acts as water in the scene. To produce this effect a height map is updated every frame with 2D Perlin Noise.

Each point on the water mesh is looped over and the x and y position of that position is used in the creation of the new heightmap value. However, a time variable is now used to push the Perlin Noise map across the plane. The time variable is also added to the x variable, this is used to create the effect of flowing water.

Water.png

A more detailed description of all techniques used above can be found ​in the report on this application.
 

bottom of page