Perlin noise

Procedural generation, a staple in video games, involves creating environments or resources randomly yet consistently. I've been developing a small world generator using this method.

World generator

Games like Minecraft use this technique for their infinite worlds. Let's explore how these methods work and the significance of Perlin noise in these tasks.

Minecraft screenshot

Procedural generation requires keeping things varied and interesting, which is why a good noise function is required for random value generation. It's important to have noise that looks natural. Below, see an image comparing completely random noise on the left and Perlin noise on the right.

Comparison of random noise (left) and Perlin noise (right).

Random noise, while useful, is too erratic to mimic nature. Nature often displays fractal-like patterns, like mountain altitudes with large (mountains), medium (hills), small (rocks), and tiny variations (pebbles). This pattern is evident in sea waves, tree branches, ant movements, and marble patterns.

Recognizing this pattern of large and small variations, Ken Perlin created a noise function to replicate it. Perlin noise is generated by summing multiple noise functions at different scales.

Perlin octaves

A random noise function simply returns random numbers, later interpolated to form a continuous function.

Noise interpolation

Combining several of these functions at various frequencies and amplitudes results in Perlin noise.

Applying this in 2D, interpolating a 2D noise function, creates a height map. The image below shows the same map colored in four different ways.

Perlin 2D coloring sample (small)

This map has various applications, like terrain creation, heat maps, clouds, or psychedelic images. More about Perlin noise can be found on Hugo Elías's page, where I sourced a couple of figures. If you find this interesting, feel free to experiment!

Comentarios

Jorge Arias Reply
Que interesante esta el tema, me servira de ayuda y punto de inicio en el desarrollo de video juegos como hobby, muchas gracias por la info. ¡Saludos!

Leave a comment

Get a mail
4d8cd43bbbfbbd2b7aed08d9a2b0ef251cebfd3e2603b74b710a2d38b7f8ec39