0
\$\begingroup\$

Background information

I am in the process of making a game engine so I have complete, explicit control over everything, anything is an option. I desire to make procedurally generated 3D terrain. It's mostly coming along quite well actually.

I am however, having a difficult time finding any good information on how exactly destructible terrain can be done optimally. I think the mesh deformations could be done at run-time and written to disk but the issue I encounter there is the desire to have ore and similar resources under the ground. I've had the idea to layer additional maps for each unit length of depth but that just seems like it'd have a heavier impact on performance than I'd like.

I know it's of course possible to do that but how to do it efficiently is what I'm interested in here. Perhaps I'm just using bad keywords when I search for information but I'm not turning up much of anything of use on this topic.

I've gone beyond just Perlin Noise for the generation as well using various other algorithms for layers such as vegetation, ground cover like small rocks, etc. By generating the texture maps using the techniques I'm sure we're all familiar with.

A lot of the ideas I've been coming up with would work I suppose but I don't like the obvious impact of performance my ideas have been so far.

Eventually of course I'd have a layer of solid indestructible bedrock but I can't figure out a way better than having a texture map for each layer down per unit length. So if I had a depth of 60 units before hitting the layer of solid bedrock that would mean 60 texture maps. I don't like that at all. Surely there is a better way. I've seen a lot of games not render or even generate the underground at all during initial creation of the game world and do that at run-time but I can't figure out how ore and similar resources could be generated in varying depth layers effectively on initial creation of the world. If the map is color coding by resource it wouldn't exactly work to also color code the height as you would with a height map. It must be one or the other.

Question

The problem I'm having now is underground. What would be the best way to implement underground layers in a performance friendly way that doesn't involve an excessive number of textures used?

\$\endgroup\$
10
  • \$\begingroup\$ I think we need some more information on your game for this. Is it 3D? Voxels, meshes? Voxels are the typical way to go for 3D terrain deformation, but modelling ores and such underground as meshes might be possible if you set your mind to it. \$\endgroup\$
    – Omegastick
    Commented Nov 13, 2019 at 8:59
  • \$\begingroup\$ It's actually for a custom engine similar to something like Unity but something we feel will work better for us (leaving opinions out of it). It is 3D mesh terrain. I am certainly willing to put in the work to make it work well. I already have Biome and Temperature/Climate mapping and all those features you'd expect to see in realistic terrain sorted out for the surface quite well. If I need to clarify on anything else let me know. \$\endgroup\$ Commented Nov 13, 2019 at 9:06
  • \$\begingroup\$ If it's meshes, then what's the problem with using 3D perlin noise to put some ore/cave meshes underground? \$\endgroup\$
    – Omegastick
    Commented Nov 13, 2019 at 9:13
  • \$\begingroup\$ 3D Perlin Noise is a very attractive option for this. I can see how I could layer that with other noise as well fractal I could see being used. What about saving to disk? That should just work out like any other mesh then and that would nullify the need for layered textures right there. This might take a little more though but off the top of my head I don't see anything with that that'd conflict with the existing surface maps I mentioned before, height, biome, temperature, etc. \$\endgroup\$ Commented Nov 13, 2019 at 9:19
  • \$\begingroup\$ It is a little tricky to figure out how to map the resources locations and store those to disk unless the best idea I have for that is having them as a child entity of the terrain (Custom ECS implementation as well). I have the rule sets in the base class for said resources that specify biomes, minimum/maximum depth, buffer radius between similar deposits, etc. \$\endgroup\$ Commented Nov 13, 2019 at 9:24

0

You must log in to answer this question.

Browse other questions tagged .