Mountains, Cliffs, and Caves: A Guide to Using Perlin Noise for Procedural Gen

jdhwilkins.com

176 points by chwolfe 4 months ago


bcraven - 4 months ago

To my geologist's eyes there is a fundamental flaw in this method: the assumption of randomness.

All mountain ranges are driven up by lateral forces, so simply look on a satellite image to notice how they are made of ranges[0]. I do wonder if this propensity can be introduced to the code.

[0] https://en.m.wikipedia.org/wiki/Zagros_Mountains#/media/File...

ianthehenry - 4 months ago

If this kinda thing piqued your interest and you want to play around with this idea, paste the following code into https://bauble.studio/:

    (def octaves 4)
    (def lacunarity 2.00)
    (def persistence 0.50)
    (def period 100)
    (def height 40)
    (plane y (fbm octaves :f lacunarity :gain persistence perlin p.xz period * height)
    # try s/color/shade on the line below
    | color (ss p.y -20 0 blue (ss p.y 0 20 green white))
    | slow (20 / height)
    | intersect (sphere 200))
(Using the terms from the article.) You can right-click and drag those numbers to see how the parameters affect the result in realtime. Also an easy way to compare perlin and simplex noise. Procedural terrain is fun!

Also while this uses 2D perlin noise -- you're just changing the height of a plane -- you can create some pretty detailed neat "rocky" terrain effects by using 3D perlin noise instead. Change "p.xz" to "p.xyz" to see what that looks like.

TheRealPomax - 4 months ago

Stop using Perlin noise and use Simplex noise, or something even better, instead. We've come up with much, much better random noise generators in the last forty years, there's really no excuse to still use Perlin, especially in a setting where grid-aligned artifacts are going to end up in your geometry. It's a "learning about noise" algorithm, not a "using it for reals" algorithm.

jampa - 4 months ago

ProcGen is a fun rabbit hole to play with and was a hobby for a whole year while I tried building my own game.

I think the best material out there was from Red Blob Games (developer of the original Realm of the Mad God), which has some old but very complete material on procedural generation, including adding rivers, biomes, using Perlin noise and Voronoi polygons

http://www-cs-students.stanford.edu/~amitp/game-programming/...

DannyPage - 4 months ago

I really wish the header image used ProcGen to create a landscape image, rather than Yet Another OpenAI Image that sours me on the article as a reader before I start to read it. It sells the wrong idea and makes me distrust the author.

tallytarik - 4 months ago

The article mentions Minecraft — if you’re interested, check out “Reinventing Minecraft world generation by Henrik Kniberg”, a great talk about procedural generation by one of the developers: https://youtu.be/ob3VwY4JyzE

mudkipdev - 4 months ago

The AI generated images littered everywhere on the website makes it look childish.

jonhohle - 4 months ago

This reminds me of terrains Bryce (with its wonderful Kai Krause interface) would generate. I had no idea Ken Musgrave, who created the algorithms, was a student of Mandelbrot. I had always assumed Bryce used Perlin noise, but it turns out I was wrong and it was using fractals.

xanderlewis - 4 months ago

It’s not a ‘topological’ map (though there is such a thing) — it’s a ‘topographical’ one. This is an error I see often.

antonkar - 4 months ago

Game developers can potentially save the world right now, we can build the Artificial Static Place Intelligence – instead of creating AI/AGI agents that are like librarians who only give you quotes from books and don’t let you enter the library itself to read the whole books. Why not expose the whole library – the entire multimodal language model – to real people, for example, in a computer game?

To make this place easier to visit and explore, we could make a digital copy of our planet Earth and somehow expose the contents of the multimodal language model to everyone in a familiar, user-friendly UI of our planet.

We should not keep it hidden behind the strict librarian (AI/AGI agent) that imposes rules on us to only read little quotes from books that it spits out while it itself has the whole output of humanity stolen.

We can explore The Library without any strict guardian in the comfort of our simulated planet Earth on our devices, in VR, and eventually through some wireless brain-computer interface (it would always remain a game that no one is forced to play, unlike the agentic AI-world that is being imposed on us more and more right now and potentially forever)

hermitcrab - 4 months ago

Nice writeup.

If you are interested in this sort of thing, you might be interested in: https://jangafx.com/software/geogen

(Haven't used it myself, but I understand their EmberGen tool is well thought of in visual fx)

tmtvl - 4 months ago

Related: Shamus Young's article on adding rivers to a procgen world <https://www.shamusyoung.com/twentysidedtale/?p=12076>.

poeticLLama - 4 months ago

Looks pretty cool, p5js: https://p5js.org/reference/p5/noise/ supports Perlin noise out of the box.

nonrandomstring - 4 months ago

Self-similarity is a really nice property for lots of sound synthesis too, so textures like water, fire and wind can make use of Perlin control and basis signals.

dr_dshiv - 4 months ago

Here’s a Claude artifact that implements this article. https://bit.ly/3FohhjG

jokoon - 4 months ago

I managed to write a glsl shader that generates perlin noise with octaves, and pull that data as 32bit float.

Much simpler than using opencl or cuda.

wwilim - 4 months ago

Most of the images don't seem to load for me