Terrain Tunneling/Arching

Feedback on past, current, and future development.
Post Reply
User avatar
Markelius
Posts: 58
Joined: 19 Mar 2013, 09:13

Terrain Tunneling/Arching

Post by Markelius »

So one of the limitations of Morrowind's terrain engine that I've always disliked is that it's locked to the z axis. This means, you can't create things like natural arches, exterior caves, or other such things without using static meshes. Depending on the scope of what you're doing, this can make certain landscaping processes very tedious. Say I wanted to make an exterior cave at the bottom of a mountain, I'd have to completely replace the terrain at the top with custom meshes and move the terrain at the bottom down to do so.

Using a better terrain system that allowed for things such as tunneling, I could do the same type of editing much easier, providing great potential for landscape modding.

I found an Ogre Demo of the type of terrain engine I'm speaking of here, I'm not sure if it's any use to you guys, but it does demonstrate what I'm describing very well.

Any chance of this being implemented in the new engine?
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Terrain Tunneling/Arching

Post by Chris »

Markelius wrote:So one of the limitations of Morrowind's terrain engine that I've always disliked is that it's locked to the z axis. This means, you can't create things like natural arches, exterior caves, or other such things without using static meshes.
This is a limitation of height-mapping in general. Each texel of the map only has one height value, so it can't define spaces that have multiple heights in one place.

What we'd have to do is use something like voxel-based terrain. This would be nice to have, but I don't know the technical details of it. Or whether it can replace the current height-mapping, or if it'd be used in addition to or in place of it on a per-cell basis.
User avatar
Br0ken
Posts: 243
Joined: 02 Apr 2012, 05:54
Location: Siberia

Re: Terrain Tunneling/Arching

Post by Br0ken »

Unfortunately, voxel terrain is slow and uses lots of memory. That's why most of the games rely on heightmaps.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Terrain Tunneling/Arching

Post by sirherrbatka »

Why we can't just define any empty space in terrain and handle it correctly (creating mesh for the space, texturing, modyfining terrain mesh to make a "hole")? Is this super complicated?
User avatar
Br0ken
Posts: 243
Joined: 02 Apr 2012, 05:54
Location: Siberia

Re: Terrain Tunneling/Arching

Post by Br0ken »

Here's an interesting comparison of heightmaps and voxels:
Heightmaps

With a heightmap, you store only the height component for each vertex (usually as 2D texture) and provide position and resolution only once for the whole quad. The landscape geometry is generated each frame using the geometry shader or hardware tessellation. Heightmaps are the fastest way to store landscape data for collision detection.

Pros:
  • + Relatively low memory usage: You only need to store one value per vertex and no indices. It's possible to improve this further by using detail maps or a noise filter to increase perceived detail.

    + Relatively fast: The geometry shader for heightmaps is small and runs fast. It's not as fast as geometry terrain though. On systems without triangle based 3D acceleration, ray marching heightmaps is the fastest way to render terrain. This was referred to as voxel graphics in older games.

    + Dynamic LOD/terrain: It's possible to change the resolution of the generated mesh based on distance from the camera. This will cause the shifting geometry if the resolution drops too far, but can be used for interesting effects.

    + Easy terrain generation/creation: Heightmaps can easily be created by blending noise functions like fractal Perlin Noise and heightmap editors are fast and easy to use. Both approaches can be combined. They are also easy to work with in an editor.

    + Efficient physics: A horizontal position maps directly to (usually) one to four positions in memory, so geometry lookups for physics are very fast.
Cons:
  • - Exactly one height per x/y coordinate: There usually can't be holes in the ground or overhanging cliffs.

    - Less control: You can only control the precise height of each point if the grid size matches the texture coordinates.

    - Artifacts: If the four vertices that define a sub-quad aren't on the same plane, the split between the two vertices will become visible. This usually happens on steep cliffs with edges that don't follow a cardinal direction.
Heightmaps are the most efficient way of rendering terrain by far and are used in many newer games that don't rely on advanced terrain features and have large outdoor areas.

Voxels

Voxel terrain stores terrain data for each point in a 3D grid. This method always uses the most storage per meaningful surface detail, even if you use compression methods like sparse octrees.
(The term "voxel engine" was often used to describe a method of ray marching terrain heightmaps common in older 3D games. This section applies only to terrain stored as voxel data.)

Pros:
  • + Continuous 3D data: Voxels are pretty much the only efficient way to store continuous data about hidden terrain features like ore veins.

    + Easy to modify: Uncompressed voxel data can be changed easily.

    + Advanced terrain features: It's possible to create overhangs. Tunnels are seamless.
Cons:
  • - Slow: To render voxel data, you either have to use a ray tracer or compute a mesh, for example with marching cubes (There will be artifacts). Neighboring voxel aren't independent for mesh generation and the shaders are more complicated and usually produce more complex geometry. Rendering voxel data with high LOD can be very slow.

    - Huge storage requirements: Storing voxel data uses lots of memory. It's often not practicable to load the voxel data into VRAM for this reason, as you'd have to use smaller textures to compensate for it, even on modern hardware.
It's not practical to use voxels for games that don't rely on voxel features like deformable terrain, but it can allow interesting game mechanics in some cases.
I think that the most appropriate in that case would be combined approach. Heightmap terrain and voxel objects. This method is used in CryEngine 2 and has the advantages of both systems.

"Voxel Objects can be used together with the heightmap to improve the look of the terrain. It is possible to model entire terrain purely using Voxel Objects, but it is much more efficient in memory usage and rendering speed not to. Rather, it’s best to model most of the terrain with a heightmap, and then use Voxel Objects to add nice features to it." - http://freesdk.crydev.net/display/SDKDO ... el+Objects

Video of voxel modeling in CryEngine Sandbox 2 - https://www.youtube.com/watch?v=PhXIkbaVaj8
CryEngine Tutorial: Creating Caves - https://www.youtube.com/watch?v=1oDQsb3OFK8
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Terrain Tunneling/Arching

Post by Chris »

- Slow: To render voxel data, you either have to use a ray tracer or compute a mesh, for example with marching cubes (There will be artifacts). Neighboring voxel aren't independent for mesh generation and the shaders are more complicated and usually produce more complex geometry. Rendering voxel data with high LOD can be very slow.
I'm not sure this is really true anymore. As the video in the linked thread shows, it's pretty fast to generate and update a mesh with LOD. Cards these days can handle pretty high density meshes... unless you have really complex vertex shaders, the killer comes from material changes. And geometry shaders can be used to add really fine detail when memory would become an issue.
It's not practical to use voxels for games that don't rely on voxel features like deformable terrain, but it can allow interesting game mechanics in some cases.
Something as simple as deep walk-in caves (no cell changes) is very impractical without voxel terrain.
I think that the most appropriate in that case would be combined approach. Heightmap terrain and voxel objects. This method is used in CryEngine 2 and has the advantages of both systems.
I think this would run into the same problem as mixing heightmaps and regular meshes. Having to recreate everything above the lowest level using voxel/mesh objects (which, depending on how expansive the underground area is, can be a very significant chunk). Matching up the texturing between the heightmap and the object would be difficult, as well.

I don't think the memory used by voxels would be that big of a problem if we only have voxel data for the actual surfaces you see and interact with, rather than building a complete volume of the ground like Minecraft would.
User avatar
Br0ken
Posts: 243
Joined: 02 Apr 2012, 05:54
Location: Siberia

Re: Terrain Tunneling/Arching

Post by Br0ken »

Сomparison was written in 2011, if I'm not mistaken.
It would be great to see the voxel terrain in OpenMW, but engine for large worlds needs highly-detailed terrain system with long-distance LOD. And, of course, good performance. I haven't seen yet implementations of voxel terrain with such characteristics. :|
Even the commercial C4 Engine with Transvoxel algorithm seems to have a rather limited LOD and low detail terrain.
User avatar
taknamay
Posts: 68
Joined: 01 May 2013, 13:22

Re: Terrain Tunneling/Arching

Post by taknamay »

I'm not too familiar with 3D engines, but couldn't you have a vector terrain? Like the difference between bitmap and .svg? I imagine that would be more efficient than voxels, but perhaps not so.
User avatar
psi29a
Posts: 5357
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Terrain Tunneling/Arching

Post by psi29a »

taknamay wrote:I'm not too familiar with 3D engines, but couldn't you have a vector terrain? Like the difference between bitmap and .svg? I imagine that would be more efficient than voxels, but perhaps not so.
Vectors... like polygons? :)
User avatar
taknamay
Posts: 68
Joined: 01 May 2013, 13:22

Re: Terrain Tunneling/Arching

Post by taknamay »

BrotherBrick wrote:Vectors... like polygons? :)
Well, more like polyhedrons. But also shapes with curved faces, etc.
Post Reply