Welcome to the Wolfire Blog! This is where we keep everyone up to date on our progress on Overgrowth and other new stuff. Be sure to subscribe to get the latest news! Also, be sure to check out the forums for even more up to date news - or get on IRC for up to the second updates.

Off the Grid Terrain

Add Comment! By Phillip Isola on December 20th, 2008

Hey guys, here is the first part of the long ago promised post on our terrain simplification. Like most other 3D games, we're generating terrain meshes from heightmaps. The easiest way to do this is to just sample from the heightmap at regular intervals and place corresponding vertices on a regular grid. Unfortunately, this can lead to chunky looking terrain and lots of wasteful vertices that add little visible detail. So, for our terrain, we decided to go 'off the grid'.


Left: Boring, on-the-grid terrain. Right: Fancy, off-the-grid terrain. Both meshes use ~21000 triangles.

Instead of placing vertices on a grid, we place them at irregular intervals. This has at least two advantages. First, our irregular meshes look more 'natural' than regular grids would (if you remember back a bit, before we had texture mapping, this is what gave our terrain it's crumpled, faceted look; even with the texture map, I think the irregularity of the mesh makes it feel less rigid than usual, as you fly about over it). Second, we are free to optimize to our heart's content: we can place lots of vertices in high detail regions and cut back in flat regions.

In order to optimize, we have to figure out which details, exactly, we want to preserve. We've been thinking a lot about what aspects of terrain contribute most to its visual impact. Since we cover the terrain with a high resolution texture map, the underlying mesh is usually hidden. However, silhouettes of the terrain still reveal its actual coarseness. Taking this into consideration, we're spending most of our vertex quota in terrain regions that are likely to form silhouettes. Ridges and peaks stick out the most, so they tend to form the silhouettes, and and thus they get first priority for vertex use.


Despite using the same number of vertices as the on-the-grid mesh (left), the off-the-grid mesh (right) has silhouettes that are much more precise.

It's also visually important to allocate detail for sharp valleys and creases in the terrain, since crease lines pop out to the viewer but are limited to following mesh edges. Luckily, such creases are just inverted ridges, and so we can treat them similarly to how we treat ridges. For the desert landscape in the pictures above, ridges really dominate, but for other landscapes (such as those with creeks, gorges, and chasms) creases will also be very important. Coming soon, I'll fill you guys in on how we actually find the ridges (and inverse ridges) we want to preserve!