Exo Terrain

Back to more terrain! Now that I have been working with domain warping for quite a while, I should be able to do terrain that goes quite a bit beyond regular Perlin noise. However, in this case, the inspiration was not just to recreate Earth-like terrain, but something akin to a terraformed Mars, that is, an arid desert with new oceans.

Woo!


This terrain obviously is quite far from being simple Perlin noise applied over the canvas. Instead, it uses a complicated formula. The main noise has both a high-frequency and low-frequency domain warping as the third dimension. This is then doubled on two different scales. And finally, some high-frequency roughness is added to some regions (depending on an umpteenth noise function). In all, for each pixel, nine different Perlin noises are sampled and combined in unpredictable ways.

function getheight(ix,iy) {
striation1 = 8*noise(ix/400,iy/400)
distort1 = noise(ix/40,iy/40)
noise1 = noise(ix/100,iy/100,striation1+distort1)
striation2 = 8*noise(ix/800,iy/800)
distort2 = noise(ix/80,iy/80)
noise2 = noise(ix/200,iy/200,striation2+distort2)*1.5
roughness = noise(ix/600,iy/600)-.3
bumpdistort = noise(ix/20,iy/20)
bumpnoise = noise(ix/50,iy/50,2*bumpdistort)
return(noise1+sq(sq(noise2))+roughness*bumpnoise-.8)
}

Let me try to explain the different parts a bit. First, what we are dealing with is domain warped noise, which uses an x and y coordinate as well as noise to generate the heightmap. This noise in the noise is split into two parts: low frequency "striation", which creates lines in the terrain, kind of like river valleys or mountain ranges - and a high frequency "distortion", which creates tendrils, that's the best I can explain it. This project shows these tendrils quite well.

Combined, you get terrain with parts that look coherent and fluid, and others that are more random and natural.


Well, there's a bit more at play than just Perlin. I am also overlapping a grid of meteor craters, each of which of course also applies a few different Perlin noises to make sure the craters are not completely round.

For coloration, hue is determined from some of those nine previously described Perlin functions, independent of their other functioning. Height is also an influence - lower terrain is darker. Most importantly, though, is gradient coloration, which places light on one side of a hill and shade on the other. This effect, of course, is not applied below water.


Here is an image of the pure heightmap without any other effects applied. This highlights just how important the gradient shading is. Also apparent is how obfuscated the meteor craters are by other effects - they are much more visible when only looking at height.


Here is a simple rendering done with some faux 3D and even more lighting. Neat, innit.

Source code can be found here:
Top-down terrain
Planetoid

For more on domain warping, see General domain warping in terrain generation.

Comments