6
\$\begingroup\$

I want to generate a terrain that has a few overhangs, and some caves. So a simple height field from a 2D noise is out, as there would be no overhangs.

The other extreme, to define a world from a 3D noise field (I typically use marching cubes over a noise field) results in a wildly chaotic terrain.

What would be a good compromise between these two?

Something that produces mostly hills (like a height field), yet exhibits the occasional overhang/cave?

I've added a bias towards 'air' at high altitude, and a bias towards 'dirt' at low altitude, but that only helps me so far. It looks a bit better, but still too alien to be a real terrain.

Any quick hacks I can try, without actually having to simulate gravity, geology, and weather systems?

\$\endgroup\$

2 Answers 2

5
\$\begingroup\$

You'll probably want to do a 2nd pass and carve caves after doing the regular quick height-map generation pass.

Find a steep slope in the low-frequency height map layer (if you use multiple resolution height map layers) and dig a cave started by using the slope's negated normal.

Same goes with crevices, canyons, and other terrain faults.

Once you build a multiple-pass system to select appropriate locations and spawn caves and canyons you can use it to span other exceptional features like volcanoes, houses, bridges, etc.

\$\endgroup\$
1
  • \$\begingroup\$ I also found a shader that generates 3D procedural terrain with caves in real-time. \$\endgroup\$ Commented Jun 12, 2019 at 20:12
2
\$\begingroup\$

A blog post at the accidental noise library addresses exactly this issue.

It offers the solution of perturbing the xy values, and of a single-pass implicit solution that creates caves that narrow as they near the surface.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .