Jump to content
  • Advertisement
Sign in to follow this  
timnwells

Techniques for creating underground caverns and tunnels

This topic is 1330 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been thinking about creating an experimental game that is set primarily in underground caverns, tunnels, and so forth. I've experimented a lot with games containing terrains and skies and so forth, but haven't done anything involving underground situations. I've seen games with underground locations that consist of square or round tunnels and so forth but I'd like to create something more natural, like caves that have formed naturally or been dug into the rock in such a way that it's natural looking.

 

My first thought is to model it using a 3d modelling package like Blender to create a mesh of the caverns.

 

I don't know if this is a suitable way of doing it, for performance reasons, not to mention memory usage and rendering, etc. I thought I'd ask for advice on the forums here and hopefully someone can provide links or suggestions on this topic that I can investigate and learn. I'd like to know what options are viable so I can research and learn and make the best choice for my project.

 

Further details if it helps. I'm currently using Unity3d but I've got some experience with a number of other engines as well as creating my own projects using c++.

Share this post


Link to post
Share on other sites
Advertisement

I am not an expert, but a few points:

  • Yes, you could model the whole thing in Blender.
  • Depending upon the size of the caverns, modelling it all as one piece could be bad memory-wise and performance-wise.
  • Some approaches re-use cavern/tunnel/stalactite segments.
  • Like many modelling issues, judicious use of reusable and one-off assets can work well.

Share this post


Link to post
Share on other sites

I have never worked on something like that, but if you want it procedural, 3D perlin noise comes to mind.

Share this post


Link to post
Share on other sites

One simple option is to overlay 2 heighmaps, one becomes the ceiling the other the floor. All kinds of tunnel-forms that you can't easily create with just 2 heightmaps though - but clever use of heightmaps in other ways might still be an option.

 

Tiling together segments of tunnel is probably one of the best used techniques. You could even procedurally generate segments if you didn't want to model them in Blender or whatever.

 

There's also Voxel Terrain. This can be particularly suited if you need to dynamically dig through your terrain to create tunnels/caverns/etc. If you render the voxels as boxes you get a Minecraft-looking world. If you render the voxels using a clever isosurface algorithm (e.g.Marching-Cubes), you get a smoother more natural looking terrain.

Share this post


Link to post
Share on other sites

caverns are typically done as a single level (skyrim), or as a level made up of seamless chunks that are tiled together to make a level (oblivion).

 

the levels / chunks can be created in a modeler (such as blender), a custom level editor (such as doom's, etc), or procedurally (as described above).

 

visible surface determination algo's such as b-trees and quad subdivide are commonly used for such scenes, especially when the poly count for a level is high, compared to the available processing power. someone doing indoor shooters can tell you more about that than i can.

 

to generate caverns for caveman, i simply start with a solid level map (all walls) and carve out spaces and halls. combine that with height mapped floors and ceilings and you get a decent effect with low effort and low overhead.

Share this post


Link to post
Share on other sites

I do like noise-based caves a lot, but I judged it as a level of complexity higher than the OP was aiming for.

 

Having said that, if we are talking about noise-based caves, traditionally you end up with some sort of density function. If you're cool with some parts being pre-generated rather than everything on-the-fly, I like the idea of making some caves look mined/explored by eroding the less dense rocks in a purposeful way, e.g. to get to particular deposits or to join caves together. You could pick targets and use a form of A* to do the mining. You could even do cave-ins based on tunnels and rock strength to add flavour.

Share this post


Link to post
Share on other sites

Thanks for all the replies. For further clarification. Initially at least the underground area I want to begin with is something I want to have as a small settlement within a large cave. So, the look I want to achieve is something of a natural cave that has sections which have been "mined" or carved into stairs or rooms, etc. Parts of the cave will be modified and have a more structured look in around the natural cave.

 

All the info on the Perlin noise and voxel terrains is great, thanks. I will do a lot more research into those techniques which may prove quite useful, especially as I expand beyond this initial location.

 

I'm not sure if using a noise method like that will allow me to add features to the cave itself (such as stairs or rooms cut into the stone), which brings me back to thinking about the modelling of the initial cave environment and then looking at using the noise techniques to exapand the caves out into tunnels and adjoining caves as required.

 

Rather than model the entire thing in Blender perhaps it's possible to use a Perlin noise technique such as described by JTippetts to generate an initial cave structure. Combining that with a Marching-Cubes or similar technique to generate a natural looking cave structure. Then convert that to a mesh and make the modifications. However I suspect that this would result in a rather complex mesh and I'd be better off creating a less detailed mesh and using bump mapping to add surface details afterwards?

Share this post


Link to post
Share on other sites

Rather than model the entire thing in Blender perhaps it's possible to use a Perlin noise technique such as described by JTippetts to generate an initial cave structure. Combining that with a Marching-Cubes or similar technique to generate a natural looking cave structure. Then convert that to a mesh and make the modifications. However I suspect that this would result in a rather complex mesh and I'd be better off creating a less detailed mesh and using bump mapping to add surface details afterwards?


This is the technique I would use, personally. It's much easier to generate the noise-based initial structure and perform custom modifications on that, than it is to build the man-made stuff first and try to fill in natural details later. You don't really have a whole lot of control over exact tunnel placement with noise.

If you use single-octave ridged functions, the result is like the third picture I posted. If you use an isosurface instead of block surface generator, the result is very smooth. I roughen the caves up using additional noise, but if the additional mesh complexity is not desired then it can be skipped and surface texture applied using bump/normal mapping instead.

Share this post


Link to post
Share on other sites

 

Rather than model the entire thing in Blender perhaps it's possible to use a Perlin noise technique such as described by JTippetts to generate an initial cave structure. Combining that with a Marching-Cubes or similar technique to generate a natural looking cave structure. Then convert that to a mesh and make the modifications. However I suspect that this would result in a rather complex mesh and I'd be better off creating a less detailed mesh and using bump mapping to add surface details afterwards?


This is the technique I would use, personally. It's much easier to generate the noise-based initial structure and perform custom modifications on that, than it is to build the man-made stuff first and try to fill in natural details later. You don't really have a whole lot of control over exact tunnel placement with noise.

If you use single-octave ridged functions, the result is like the third picture I posted. If you use an isosurface instead of block surface generator, the result is very smooth. I roughen the caves up using additional noise, but if the additional mesh complexity is not desired then it can be skipped and surface texture applied using bump/normal mapping instead.

 

 

Thanks. I will read your article and do more research into this method.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!