Procedural Generation of Painterly Mountains
Last time I showed the revamped world look, with poisson disc distributions of vegetation. Mountains were absent in that version. The reason is, I don't have any good graphics for mountains. To add to the problem, I would need mountains that could be applicable to many biomes, and that's not that easy either! Things that I find available online are tile-able far-zoomed-out mountains, or 2D backdrop style.
For years I had been tempted with the idea to procedurally generate mountains, and I guess the time came to try it out.
Requirements
- Lots of mountain variation
- Ability to generate mountains for multiple biomes
- Mountains should be somewhere between pixel art and painterly, as found in a good-looking retro-style 2D game
- Be able to overlay mountains together to make mountain ranges
- Mountains should be billboards rather than decals: The projection should be top-down oblique, like this
Process
- Simplex noise added to a sort-of-bell-curve, to generate outline
- Pick the top point and generate downwards "main" ridge, using some more Simplex noise
- Maybe generate some mini ridges at stationary points, mostly using same settings but smaller length
- Identify "left" and "right" sides of mountain, and make sure the "left" side is lit better
- Calculate distance field from main ridge, and use it for shading
- Calculate dijkstra map using all ridge points and outline points as goals, and use it for shading
- Calculate a downwards slope direction for each of the "left" and "right" sides, and use that to distort a Simplex noise domain, which we sample to change the shading even more
- Use Simplex noise to calculate the tree line, also based on the highest peak
What contributes to the mountainside luminance?
All the below are luminance factors that get multiplied together to give the final luminance
- shading based on pathfinding distance to the outline (a bit darker near the outline)
- side: 1 if on the left side, 0.75 if on the right side of the main ridge
- shading based on pathfinding distance to the main ridge (a bit lighter near the main ridge)
- domain-warped Simplex, different distortion based on the side of the mountain (left/right)