Nerd For Tech
Published in

Nerd For Tech

Generating Digital Worlds Using Perlin Noise

Photo by Ales Krivec on Unsplash


What is Perlin Noise?

Example of Perlin noise vs random noise

Generating Heightmaps

Example of Perlin noise heightmap generation

Generating An Island

Examples of a circular mask (left) and a masked heightmap (right)

Threshold Sliders

Examples of heightmap with threshold set to zero (left) and 0.5 (right)


Interactive example of heightmap generation

Increasing The Complexity

Coloured Islands

Try generating your own islands!

Ridged Noise

Warping Noise

Further Extensions

  1. 3D meshes. This is more a prerequisite for the next two suggestions, but bringing your world into the third dimension will make it much more interesting. I’d recommend using either the Unity game engine or the Processing Java IDE. Processing is easier to jump into, but Unity will make it easier for you to create intricate environments down the road.
  2. Voxel terrain. Ever heard of Minecraft? Yeah — try making your own version. Instead of sampling the Perlin noise in two dimensions try sampling it in three and placing a cube wherever it’s greater than some threshold. It’s not as simple as a basic mesh but it lets you create complex features like caves and overhangs.
  3. Marching cubes. This algorithm is basically a method of taking voxel terrain and making it look smoother. If you’re interested in this I’d suggest checking out Sebastian Lague’s coding adventure for further context, or feel free to steal my code from Github.