top of page
Writer's pictureKane Adams

Using Fractal Noise to Add Detail

My lecturer explained that having a basic Perlin noise algorithm wasn't enough for a pass due to him having taught the theory early in my undergraduate degree, so in response to this I have spent the time working on adding fractal noise to add complexity to the algorithm. This would also greatly help the project as currently the hills are lacking in quality and fractal noise would help add detail.


What is Perlin Noise?

Despite the fact that I have mentioned that I am using Perlin Noise, I haven't given any explanation to what it is.


Perlin noise is a pseudo-random pattern (usually on a 2D plane referred to as a noise-map) that stores values between 0 and 1 represented by black and white with a gradient to blend between the two extremes.

Example of Perlin Noise

This was originally created to help remove the machine-like look from CGI but is now largely used within the games industry as terrain generation. With the noise being in 2D, the value stored at a set point (the value between 0 and 1) can he used for the height of an object instead, with 1 being the highest point. However, the use of only the values 0 and 1 tends to mean the tallest point isn't that high so a multiplier is added. In my version, I am using the Perlin noise value to alter the height of the mesh and to colour in different sections (in my example, a value below 0.25 are blue to represent sea and values above 0.9 represent snow on top of mountains).


Isometric view of Perlin noise coloured

Same Perlin noise, but with height

Fractal Noise

Fractal noise is the use of multiple Perlin noise maps with altered values and layering them on top of each other. This is used in terrain generation as it removes the smoothness of the pattern, in my particular case it causes the mountains to become more rocky and look more natural.

Fractal noise has 3 main elements that impact how the layers differ from each other:

  • Octaves - How many layers are generated

  • Persistence - How much each layer impacts the final noise map, value between 0 and 1

  • Lacunarity - How detail is added for each layer


Persistence is multiplied onto the amplitude and the lacunarity is multiplied to the frequency where both those variables start from 1 for the first octave and with every iteration the frequency increases and the amplitude decreases.



Implementing Fractal Noise

The addition of fractal noise was very easy, each chunk was able to have a rough looking terrain that could be changed in the inspector. However, with the addition of fractal noise the chunk generation stopped working as intended.


The chunks were all generating but the offsets for each Perlin noise changed the seams causing none of the chunks to line up with each other.


Fractal noise with chunk bug

Top-down view of chunks using Fractal noise

After attempting different ways to alter the offset values to try and get the chunks to line up, I altered the offset by the frequency and similarities between the chunks did appear, showing that now the chunks had the same first noise layer but the inclusion of more octaves was causing the noises to become different.


Chunks having similar noises but not enough

Top-down view of similar noises

Unfortunately when I went to ask for help, my lecturer was unavailable, however a course mate I was discussing the problem with worked out the issue when neither of us were talking about it through something I said, I happy coincident.


The solution to the issue was I needed to include a total amplitude variable where the sum of all iterations of amplitude were added up and the Perlin noise was normalised using inverse lerp between 0 and total amplitude.


Working Fractal Noise

Top-down view of working Fractal Noise

Once I completed this I altered the amount of octaves around and I felt 10 iterations gave the right amount of detail with a persistence of 0.33 and lacunarity of 2.


After this tricky task, I have decided that I want to work on a simpler task and create two separate demos showcasing only the algorithms and allowing a user to alter values to see different results. The idea came from concern of not being able to get both the chunk generation and fractal noise working together with the intention of showing each part can work. Now with it working as one scene, the reason for creating small demos is to show that my work is modular and can work without requiring too many different scripts.



16 views0 comments

Recent Posts

See All

Comments


bottom of page