Terrain Texturing: To Blend or to Stitch?

Started by
1 comment, last by chronos 15 years, 8 months ago
I'm trying to decide how best to texture a Chunked LOD terrain. I could either blend between various tiled terrain textures whenever a chunk is loaded into memory, or I could load an image from disk and use it directly as the texture for that chunk. I find myself unable to decide between the two options. Consider: With blending, the closer you get to the root of the quadtree the more distinct terrain types are likely to be present within each chunk. Whereas rendering a leaf chunk may require blending between four distinct terrain types, that chunk's parent may require blending between sixteen (four per child). This means multiple passes and just as many more blend maps, thus increasing processing and storage space requirements. To make things worse, the need to share borders with neighboring tiles (to avoid artifacts due to texture filtering) means that even a leaf chunk may require blending between more than four different terrain types. An alternative to the above is to load an image directly from disk and use that as the chunk's texture. Unfortunately, storing a unique image for each terrain chunk may require greater storage space than storing only tiles along with the information necessary to blend between them. Although it's possible to significantly reduce memory requirements by creating a compressed texture pyramid (as for Geoclipmaps), I'm still concerned that it may require too much memory. Of course, it's possible to combine both techniques, with blending for the finer levels and unique images for the coarser levels. Even so, unless blending is restricted to the leaves of the quadtree (which might not provide a sufficient storage-space advantage), blending between tiles at anything other than the leaves is still more complicated than I'd like it to be. What do you think?
Advertisement
There are better ways to blend between ChunkLods

if you have 2 chunks with a difference of "1" in their LOD level your shared edges may look like this
01234
024

Thats where you get the gaps, that need to be stitched

Instead of this you could use a slightly different approach,
keep the edges between different LOD levels for now
01234
01234

and instead of reducing the grid resolution of each chunk you can use edge collapses ("progressive meshes") that operate on the previous higher detailed lod level. Use "crease angle" as a criterion for mesh refinement

E.g.:
LOD 0 fulldetail
LOD 1 uses edge collapse to half the number of triangles
LOD 2 half the number of triangles
...

Now you need to handle the borders of each chunk

You kept the original border,
so you can now generate 2 borders per chunk
01234 for level n-1
024 for level n+1

This way you need 2 draw calls per chunk, but you can get rid of this if you arrange your triangle indices like this
[LOD n-1][interior triangles][LOD n+1]
now you only need to add the offset to your draw call

pros/cons:
+ better mesh quality
+ pretty fast, generating 4000 edge collapses runs at 2 ms on my computer here
- triangle neighbourhood information required
should be straight forward to calculate from a heightmap

As for texturing
blending several layers in a shader is memory friendly, on the other hand you can t add fine details.
If you are using a heightmap terrain, streaming a image from the HD is fine, see itech?'s megatexturing.

If your terrains has caves and overhangs you will have a little problem with pregenerated textures.
http://www.8ung.at/basiror/theironcross.html
For terrain meshes I've decided to use skirts instead of stitching the edges together because otherwise the blending between LOD levels becomes too difficult for me to understand and implement. Skirts are conceptually ugly, but they make blending between LOD levels a trivial matter.

With regard to my original post, when I speak of stitching I am talking about stitching together pregenerated textures that together make up the terrain's surface, similar to megatextures. Also, when I speak of sharing edges I am referring to duplicating texture edges rather than mesh edges, in order to avoid artifacts from texture filtering.

I wish to minimize storage space requirements through texture blending, but I can't think of a way to do so that isn't significantly complicated by the quadtree structure of Chunked LOD.

This topic is closed to new replies.

Advertisement