2
\$\begingroup\$

Every search I do results in heightmap based terrain, where you can't have a tunnel, or cave, etc within the terrain.

What good algorithms are there to do this kind of deformable terrain?

I'm aware of voxel based terrains, however I would like to explore not necessarily aligned, mesh based ones.

\$\endgroup\$
7
  • \$\begingroup\$ wave function collapse and it's multiple variations, else just make multiple seamless meshes and arrange them procedually then fuse them into one. \$\endgroup\$
    – Cei
    Jul 18, 2023 at 21:39
  • \$\begingroup\$ Can you describe what you mean by "arbitrarily aligned mesh based ones"? If you want tunnels, you'll need a mesh with arbitrary topology — so either tiles you assemble, or that you generate on the fly marching cubes / dual contouring style (which I guess could be argued to be small tiles with a post-process distortion). \$\endgroup\$
    – DMGregory
    Jul 18, 2023 at 22:24
  • \$\begingroup\$ @DMGregory Fixed it. I shouldn't have used "aligned" there. I meant to say not aligned really. \$\endgroup\$
    – gak
    Jul 19, 2023 at 1:06
  • \$\begingroup\$ Can you describe what you mean by "not aligned", then, to help us understand what needs to be different from the usual approaches sketched above? \$\endgroup\$
    – DMGregory
    Jul 19, 2023 at 1:17
  • \$\begingroup\$ @DMGregory I mean not necessarily aligned to a grid. Mesh vectors can be at arbitrary positions. \$\endgroup\$
    – gak
    Jul 19, 2023 at 5:19

1 Answer 1

2
\$\begingroup\$

A height map defines a height for each point of your plane tessellation mesh grid. So it is defining an offset on the vertical axis. Or, if you will, vertex displacement on the vertical axis.

Using a height map the traditional way to get overhangs is to add meshes on top of the terrain.


As alternative, instead of defining just a displacement on the vertical axis, you could define displacement on all axis... That is, you could define a vector. It can still be a texture, except you use separate color channels for each axis.

That is, you would use vector field displacement maps. Yes, it is similar to vector displacement map in sculpting software, but I'm NOT asking to dynamically tesselate your mesh - to be fair, you could.

First of all, this means that you can use the map to move the points along the plane of the terrain. Which means you can move points away from areas that need less detail, and towards areas that need more detail.

And once you have additional points in the areas where you need them, you can lift them off the terrain and sculpt them to make overhangs.

See HALO WARS: The Terrain of Next-Gen (GDC 2009).


However, what I said above is NOT enough for a tunnel or a cave system. The reason being that we are displacing the vertex, but the topology is the same. Thus, a hole through one side of the terrain to the other (such as a tunnel) is not possible.

For that, you could define holes in the terrain. That is, you use a mask to decide which vertex to discard (e.g. alpha scissors). And then stitch in the hole another mesh which might or might not have been created with the same tools.

And, of course, as you are already aware, you could instead work with voxels or implicit surfaces (and mesh them with marching cube or similar approaches).

\$\endgroup\$

You must log in to answer this question.

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