perlin terrain test
2023-08-17
2023-08-17
p5.js
Ben Bleything (b. 198x)
p5.js on <canvas>
for a new map • get the code >>

This is a super basic example of using Perlin noise to generate a map. The idea is that you sample the noise function for each pixel and it becomes the “elevation” of that point. In this sketch I use that value to choose a color for the pixel from a limited palette, which generates something like a terrain map.

You can take this much, much further. Red Blob Games has a great post if you want to dig deeper.

This is a super basic example of using Perlin noise to generate a map. The idea is that you sample the noise function for each pixel and it becomes the “elevation” of that point. In this sketch I use that value to choose a color for the pixel from a limited palette, which generates something like a terrain map.

You can take this much, much further. Red Blob Games has a great post if you want to dig deeper.