| Submitted by , posted on 04 March 2001 |

Image Description, by In previous IOTDs, many people asked what algorithm Terragen is using to calculate its textures. Since i didn't dare to post YALS (Yet Another Landscape Screenshot), i prefered to send this one (which is a top view of my terrain) with a short description of how i'm texturing it (i don't know if Terragen does the same thing, but the results look quite similar).
First, before you ask:
1. It is realtime rendered, and actually quite fast (there is around 8000 triangles in this frame). I expect 150 fps on a P2-400+GeForce. Brute-force method: no LOD (yet).
2. It is not using a Terragen's texture. Terrain textures are completely procedurally generated.
3. No demo yet, but i'm working on one. Still needs a few weeks of work.
Now, some words about the technic:
I'm using a set of 3 parameters: elevation, slope and exposition/ orientation for each texel. Designers can use a script language to describe how to texture-map the terrain. It is done, as Terragen, with materials layers. To each layer is associated a texture map (grass, rock, mud), some conditions about the elevation, slope and exposition, and for each parameter, a min/max blending coefficient too.
The influence (ranging from 0.0 to 1.0) of a given layer is calculated, for a texel, by interpolating the 3 blending coefficients. Then, we get the final color of the texel with a standard n-blending function.
It is also possible to specify specific texture maps for some texels, as shown with the muddy road in the shot.
A simple script example would be:

    Grass {
            Slope {
                    angle_min:0             # min angle condition (degrees)
                    angle_max:31            # max angle condition (degrees)
                    blend_min:0.9           # blending for min angle
                    blend_max:1.0           # blending for max angle
            }
    }

    Sand {
            Slope {
                    angle_min:31            # min angle condition (degrees)
                    angle_max:90            # max angle condition (degrees)
                    blend_min:0.8           # blending for min angle
                    blend_max:1.0           # blending for max angle
            }

            Elevation {
                    height_min:0.0          # min height (in meters)
                    height_max:10.0         # max height (in meters)
                    blend_min:1.0           # elevation blending is identiy
                    blend_max:1.0
            }
    }

    Rock {
            Slope {
                    angle_min:31            # note that these are the same
                    angle_max:90            # parameters than for sand. Only
                    blend_min:0.8           # the elevation condition
                    blend_max:1.0           # changes.
            }

            Elevation {
                    height_min:10.0         # min height (in meters)
                    height_max:10.0+        # max height: above 10 meters
                    blend_min:1.0           # elevation blending is identiy
                    blend_max:1.0           # too
            }
    }

I let you, as an exercise, imagine what sort of terrain this would result in :)

[prev] | Image of the Day Gallery www.flipcode.com | [next]

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.