The Coder's Handbook

Perlin Noise

WHAT IS NOISE?

Have you ever wondered how a game like Minecraft generates terrain? We hear a lot about video games doing "procedural generation." This is something different from simply randomly generating numbers.


Randomly generated numbers have no pattern. Instead, we can use a noise algorithm to generate a series of values based on a seed that aren't truly random. They relate back to each other mathematically, and create a more natural looking distribution.


There are many noise algorithms, but the most famous, called Perlin Noise, was created by Ken Perlin in 1983. He would also go on to create implementations of Simple Noise, another commonly used noise function.


Perlin Noise uses extensive linear algebra. You don't need to understand how it works, but you will find it incredibly useful to apply to your programs!

Ken Perlin is currently a professor at NYU. You can find his webpage at https://cs.nyu.edu/~perlin/.

ONE DIMENSION


Use Cases

  • Drawing handwritten lines

  • Create height maps for terrain in a game where depth doesn't matter.

TWO DIMENSIONS


Use Cases

  • 2D Terrain Generator (Terraria)

  • Create natural textures,. such as fires or nebulae


THREE DIMENSIONS


Use Cases

  • 3D Terrain Generator (Minecraft)

RESOURCES

TheBuffEd - An example of using 2D Perlin Noise to create a world map in Python

Shiffman Part 1 - Perlin Noise (P5JS)

Shiffman Part 2 - Noise vs. Random (P5JS)

Shiffman Part 3 - 1D Perlin Noise

Shiffman Part 4 - 1D Perlin Noise