Perlin Functions



While Perlin noise is fine on its own, one can create fundamentally different terrains by applying some simple transformations to it.  I have made eight different functions that showcase the different options. They are showcased at:
https://www.openprocessing.org/sketch/584559
But I will also explain them here in a bit more detail.


Linear

This is just the completely normal Perlin-noise, mostly here to explain the interface. Up in the top-right corner, we can see the function that transforms the Perlin-noise. This transformation is, well, f(x) = x, that is, no transformation at all. This is instead the base to which we will compare the other versions.

The thing about normal Perlin noise is that it has hills and valleys, but there is not a big difference between the two. A piece of terrain of one altitude is similar to that of another. All parts of the terrain grab the viewer's attention equally. Thus, simple Perlin is a short-hand for generic terrain, but that's all it is. Generic terrain.


Classics



A classic approach is to put extra emphasis on the coastlines. This is done here by making the ocean completely flat. Alternatively, as seen on the example of the top of the blog, one can keep the ocean height-map, but still seperate the colours enough that what one really notices is the contour. The classic approach puts emphasis on the coast-line, but we can still recognise the very same shapes of Perlin noise as before.


Channel and Islands

The reason the coastlines are so interesting is that the mid-point of the Perlin noise spectrum perhaps is the most interesting part. The midpoint, whether it is zero, or as in these examples, ½, is the most frequently occuring value. Additionally, all areas that are above this value must have a rim, or channel, of the mid-value between them and areas with values below.

That's just a very complicated way to say that coastlines seperate land and ocean.

But still, we can use this:


The channel map emphasises the coastlines, by having the biggest inclines near the midpoint of the Perlin noise map. However, in this simple, unaltered form, it leads to some unappealing terrain. All landmasses are round, and the channels themselves go way too deep.


The Island map is a bit of a compromise between the channel map and a linear function. It is exemplified by frequent islands with short channels between them.



Lunar and Canyon

Alternatively, we can play around with sin(x).


Using a factor of π/2, we can create more gentle terrain. The function should probably be lowered, because right now, most of the Perlin map is above ocean-level. If we were to look at those rare spots below water, we would see that it is the opposite - quite chaotic, and not gentle at all, because the function is the steepest at low values.

Here, the colouring scheme is a bit off, because what this reminds me of most of all is the ruined terrain of dry planets - craters, abysses, so-forth, hidden beneath the soft lunar sand. Or that's my assocation, anyway.



Taking this to the maximum, we can instead use a factor of a full π, meaning that we will go through the whole realm of 0, 1, and 0 again. To make it more interested, I am taking the square of the value - since the value is between 0 and 1, the square will make the lower values even lower, and hardly change the high values.

This picture might not be the best example, but sometimes this creates terrains like the grand canyon - a great crevasse with spears of remaning rock jutting out here and there.


Steep

The logistic function is really interesting.


It, too, exemplifies the values close to the mid-point of the frequency function, creating steep inclines between land and water. However, with its amazing logistic properties, it never quite flattens out.

I should mention, the function written up at the graph in the top right corner is a lie. The true function is first:

x = (x-.5)*8
and then:
x = 1/(1+exp(-x))

The 8 can be changed to make it more or less steep, and no matter what, it will always stay between 0 and 1. That is magical, I'd say.


Himalayas

Finally, cheating a bit, I am going to introduce an extra, higher-frequency, source of Perlin noise into this last one:


Here, the landmasses are marred with mountains, while the water has (mostly) the same gentle curves as normal. This is of course done to simulate what I wrote about in Country Terrains - Greece, though in a much more simple version.

I guess it is mostly as a final example that all of this has been quite simple so far, and all that one can add so much more complexity in.



Well, then. This has been eight different functions to transform Perlin noise. Again, link to code and live demonstration is here:
https://www.openprocessing.org/sketch/584559
Do play around with the code, create your own favoured type of terrain!

Comments