Country Terrains - Morocco

I felt I had been posting too much about Country Terrains already, and I doubt I'll post about all nine terrains, but at least with Morocco, I do have something I want to say. It might be one of the best examples of a really elegant approach. It's simple, really. So simple, yet so effective.



From the beginning, I knew I wanted to create sand-dunes, as seen by wavy lines streaking across the terrain. For this purpose, I used a sine-wave controlled by the x and y-coordinates:


These are not actually exaggerated - this is the real, original wave-length of the waves. But apart from the coordinates, an extra value was added into the sine function; the same noise layer that in Greece was used to create mountains. I just multiplied this Perlin noise value by a huge amount, and out came:


Well, isn't that interesting. To learn more about the kind of patterns we see here, I recommend reading my surprisingly popular post on Contour maps. But it really is just the result of taking:
sin(coordinate+Perlin_noise)
The best solutions are often the most simple ones.

But we are not going to add in these lines everywhere, that would be too much. Instead, it is controlled by the height of the terrain, capping off at a certain level. This is why, in the original picture, the valleys are free of the sandy dunes. To illustrate a bit better the interpolation to the dunes, here the simplified sine function is used:


This actually looks pretty nice with the long, straight lines, and might be closer to the original idea I had, but from an aesthetic standpoint, I think the contorted, mostly non-straight lines, are most interesting.

One last thing. If I am not interested in the straight, linear dunes, why even add the coordinates into the sine function, why not just use the Perlin noise?

This is to create the difference between regular contour lines and, er, broken contour lines, basically? Regular contour lines have a tendency to go in rings. I tried to create a nifty illustration of this effect, but it's difficult. You'll just have to trust me on this one.

Also Morocco would not be Morocco without its colours, which look like this:
Generally, its terrain is higher than the other biomes, because, you know, it's a desert, not a lake resort.

Last but not least, you can generate your own Moroccos and see the code here:
https://www.openprocessing.org/sketch/584407 for Morocco
https://www.openprocessing.org/sketch/584559 for nine terrains, including Morocco

Comments