Live data from Hacker News

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

jdhwilkins.com

1–10 of 36 posts

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

#2
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...

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

#4
post #2

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...

Certainly! The limit is your creativity. My first idea: generate very large scale 2D noise. Choose a threshold to divide it into regions. For each region, choose a direction of motion. Design a “mountain envelope” function that considers distance from the nearest border to create mountains/subversion zones based on the direction of each plate and the shape of the border.

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

#5
post #4
post #2

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...

Certainly! The limit is your creativity. My first idea: generate very large scale 2D noise. Choose a threshold to divide it into regions. For each region, choose a direction of motion. Design a “mountain envelope” function that considers distance from the nearest border to create mountains/subversion zones based on the direction of each plate and the shape of the border.

You can also do similarly for water erosion, plotting channels where it runs downhill, carving a little on each cycle (and some terrain engines do).

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

#6

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.

...and especially since this is a convention the author uses for all their articles. The AI images make the whole site look fake.

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

#8
post #2

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...

You can get much more realistic results at a smaller scale for e.g. waterways using iterative methods -- simulating rainfall and erosion. I imagine the same would be true at mountain ranges using some model of your lateral forces to influence the heightmap. The main issue with this will be the computation time, naturally. Not that that should stop anyone, but it's likely the reason you don't see it in shipped games.

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

#9
post #2

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...

One thing you can do is take a DEM and match the distributions, then sample those distributions for new terrain. This can (in theory) reproduce any characteristic represented in the original signal. It can even be relatively efficient compared to things like erosion models if you constrain the number of octaves in the signal.

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

#10
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.

Post reply on HN