[HN Gopher] Mountains, Cliffs, and Caves: A Guide to Using Perli...
       ___________________________________________________________________
        
       Mountains, Cliffs, and Caves: A Guide to Using Perlin Noise for
       Procedural Gen
        
       Author : chwolfe
       Score  : 163 points
       Date   : 2025-03-04 17:19 UTC (4 days ago)
        
 (HTM) web link (jdhwilkins.com)
 (TXT) w3m dump (jdhwilkins.com)
        
       | bcraven wrote:
       | 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...
        
         | dizzant wrote:
         | 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.
        
           | kevindamm wrote:
           | 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).
        
         | qwery wrote:
         | 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.
        
           | fc417fc802 wrote:
           | Diffusion limited aggregation is another interesting option
           | for mountains assuming you're willing to employ an approach
           | that isn't single pass. However a naive implementation is
           | _extremely_ expensive compared to other iterative options.
           | 
           | To be fair to OP though it doesn't model lateral forces. It
           | just produces a visually plausible result (to my non-
           | geologist eye at least).
        
         | AlotOfReading wrote:
         | 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.
        
           | jesse__ wrote:
           | What's DEM?
        
             | nairoz wrote:
             | Digital Elevation Model
             | (https://en.wikipedia.org/wiki/Digital_elevation_model)
        
         | nxobject wrote:
         | In general, are aware of any physically-based long-term
         | geological process models with real life fidelity as a goal,
         | and that have a remote chance of being feasible for gamedev?
         | 
         | I imagine that, analogous to work done in weather forecasting,
         | someone can shove DEM files into the pattern-matching engine of
         | an AI, but I do wonder how feasible a completely algorithmic
         | model will be.
        
           | Cristan wrote:
           | Not sure if this is what you're asking, but take a look at
           | Terra Firma on Steam:
           | https://store.steampowered.com/app/1482770/Terra_Firma/
           | 
           | I don't know what tech they're using, but it does have
           | erosion, water flow and sediments, plus others. I see they're
           | planning a paid version with more features this year. I've
           | only played an alpha some time ago, but it should be possible
           | to export the maps to use in other programs.
        
         | fc417fc802 wrote:
         | This image from the same article is stunning. Those massive
         | formations look like CGI to me. They're just too far removed
         | from the sort of mountains I'm familiar with.
         | 
         | Notice the cars in the foreground for scale.
         | 
         | https://en.m.wikipedia.org/wiki/Zagros_Mountains#/media/File...
        
         | baq wrote:
         | You generally start with some kind of perlin noise and then add
         | plate tectonics e.g. with voronoi diagrams (use anything you
         | want), then add climate, erosion etc. however many passes you
         | like. It's a fascinating rabbit hole.
        
         | bbkane wrote:
         | I think https://veloren.net/ has contributors who have put a
         | lot of work into simulation geology, but I can't recall the
         | place I read that
        
       | DannyPage wrote:
       | 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.
        
         | grimpy wrote:
         | ...and especially since this is a convention the author uses
         | for all their articles. The AI images make the whole site look
         | fake.
        
       | mudkipdev wrote:
       | The AI generated images littered everywhere on the website makes
       | it look childish.
        
         | ryanwhitney wrote:
         | I have no idea why people do this. To me, it only serves to
         | devalue the rest of the content.
         | 
         | It's especially egregious in this case because the post is
         | about something visual. The art is built-in! Why oh why.
        
       | ianthehenry wrote:
       | 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 wrote:
       | 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.
        
         | baq wrote:
         | Ultimately the goal is to make something good looking, how does
         | a different noise algorithm matter? IOW why simplex generates
         | better height maps than perlin?
        
           | TimorousBestie wrote:
           | Parent basically says it but Perlin noise tends to generate
           | spatial correlations that don't look uniform. Simplex noise
           | doesn't.
           | 
           | On the practical level, Simplex noise is also faster and
           | generalizes to n-dimensional noise easier.
        
       | xanderlewis wrote:
       | It's not a 'topological' map (though there is such a thing) --
       | it's a 'topographical' one. This is an error I see often.
        
       | wwilim wrote:
       | Most of the images don't seem to load for me
        
       | tallytarik wrote:
       | 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
        
       | hermitcrab wrote:
       | 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)
        
       | jonhohle wrote:
       | 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.
        
         | jonah wrote:
         | Any time algorithmic terrain generation comes up. I always
         | think of Bryce. What a revolutionary product. I had an amazing
         | time working at Meta Creations right out of school. So many
         | smart people and great stories.
        
       | poeticLLama wrote:
       | Looks pretty cool, p5js: https://p5js.org/reference/p5/noise/
       | supports Perlin noise out of the box.
        
       | jampa wrote:
       | 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/...
        
       | antonkar wrote:
       | 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)
        
       | nonrandomstring wrote:
       | 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.
        
       | jokoon wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2025-03-08 23:01 UTC)