Procedural Generation

Seamless planetary landing on fractal worlds


Development: 1 Week (Solo Project)
Finished: Jan 2013
Genre: Shader

This is a shader that generates textured worlds by adding octaves of Perlin noise. The mesh is tessellated as the player approaches. This allows for seamless planetary landings and highly detailed terrain.

Demo Try it out!

← Click here to launch the webplayer and try the procedural generator shader for yourself!

Requires: GPU supporting DirectX 11

Turbulence The next step

Heightmaps generated with pure Perlin noise lack erosion features such as ridges and valleys. This can be improved by applying a turbulence function to modify the Perlin noise value, p, or the amplitude of higher frequency octaves by modifying the gain.


In this example we have simply taken the Perlin noise to the power of 2, pow(p,2). This gives us bulbous rocky looking terrain. The gain is set to be proportional to the slope, causing higher octaves to be damped down in flat areas on peaks and valleys. The terrain has also warped using Perlin noise to modify the lookup position of each point. This helps to give the illusion of rivers having shaped the terrain. Ambient occlusion can be calculated for the terrain by the sampling nearby terrain to detect local minima and shading those regions darker.
   1) Diffuse Lighting
   2) Ambient Occlusion
   3) Dynamic Shadows


Ridged turbulence is created by taking 1 - abs(p). In this example, gain is proportional to altitude, damping higher octaves in basins and valleys. This mimics alpine terrain, where material eroded at the peaks is deposited in valleys below. I am using a smoothed version of the ridge equation above to prevent high frequency octaves leaving strange sharp trails when the normal map is calculated.
   1) Smoothed Ridged Turbulence Function
   2) Ridged Terrain with Sandy Valleys


The final height value can be modified, multiplying it by some damping value within a certain height range, to create beautiful canyon features. This clamping value can be relaxed, allowing terraces to blend smoothly with nearby terrain and vanish in a natural fashion.
   1) Terracing
   2) Blending Terraces into Ridged Terrain


The lava in the example below uses 2 turbulence functions. The base turbulence function is Square Turbulence, 1-pow(p,2). This is then etched by a negative Gaussian turbulence function, -exp(-pow(p,2)). The glow effect is calculated in the same way as ambient occlusion except that we reverse the sign of the tint and put this value is drawn as self-illumination. This means that all cracks and fissures in this area will give off a dull red glow.
   1) Square and Gaussian Turbulence Functions
   2) Lava with Negative Ambient Occlusion


Many more turbulence functions exist and each function can be combined and blended across different octaves, allowing you to create a wide range of interesting and varied terrain types. Below are some more examples of turbulence.
   1) Wind Blown Dunes: Warped Square and Gaussian Turbulence
   2) Raymarching along the view vector for volumetric water lighting
   3) Applying Perlin noise to the terrace height creates beautiful alien terrain