directxmeshtriangulationtesselation

Why using triangulation for flat terrain?


I've seen many terrains in wire mode and all of them used triangles. I get it if you use it for different heights BUT why do people use so many triangles for flat areas in their terrain? If there is a large flat area wouldn't it be wise to create one big square or at least one big triangle (as big as possible) instead of using so many small ones?

So my question is, is there a reason to do this (maybe for textures)? I know tesselation does something like this but still leaves too many triangles from my point of view.


Solution

  • Possible reasons:

    1. They don't have terrain optimization routines.
    2. They use vertex lighting. Unless terrain is densely triangulated, it'll look horrible.
    3. Shader does not work well with huge triangles. Interpolating huge values (like light dir etc) across a triangle might cause precision problems.
    4. Physics engine does not work with huge triangles.
    5. Huge triangles cause artifacts (I think there's a hardware-dependent limit on number of texture repeats).
    6. Multiple materials (more than 8) across terrain. That'll go above multitexturing limits on certain cards, so it'll be necessary to split terrain.
    7. Multiple different materials or regions across terrain, streamed zones. Different materials might require different texture coordinates, etc, and if there's some kind of 2nd set of coordinates on top of the terrain (optimized unwrapped lightmap), you won't be able to use one big flat triangle.
    8. Per-pixel lighting with multiple sources. If you have several light sources, and want to use them all at once, you might have to use additive alpha-blending. With triangulated terrain you can pick out a small region that is affected by this particular resource, and redraw it with added specular from that lightsource. If you simply cut big triangle with clip-planes, you'll see z-fighting. If you don't select small region of terrain light affects, you'll have to redraw entire terrain, which is very likely to cause performance drop (fillrate/shader performance because many pixels are redrawn).