Custom Search

3D programming : Generating Terrain Textures (2)





Generating Terrain Textures from flipcode.com
by Yordan Gyurchev (31 May 2001)



Introduction


Several months ago I was working on a terrain algorithm. When it was implemented, all of a sudden I realized that I needed some textures. At that moment I rushed into this texture generation stuff.

Here I’ve provided the stuff I’ve found on the net, fertilized with my own ideas.


The Theory


There are different types of terrain. You can call them different types of land if you like. There are for example snow, rocks, grass, mud, etc. Those can be found at various places in nature.

The texture synthesis in this paper is based on combining all types of terrain but weighted with factors according to the traits of the specific place. For each terrain type a probability factor is calculated and then used as a weight while calculating the color of the current pixel.

Calculating the weight

Factors defining the influence of a certain type of terrain at the current point:

Elevation

We have snow on the top of mountains and mud/grass in the lower places (take heed that rocks can be found in all elevations). Thus we need a minimum and a maximum elevation value for every type of land.

Thus for a snow land we will have min/max values 200/255 while for mud land these values may be 5/64.

Slope

Imagine the top of a mountain. It has snow at the top but if you take a close look at really steep piece of land there is hardly any snow but rocks although it happens to be in the snow elevation.

Let us introduce the second factor: slope. It will be specified in degrees.

For a snow land we will have minimum slope 0 and maximum 80 degrees. Thus leaving the range from 80-90 degrees for rocks…

This can be explained with grass/rocks, mud/rocks etc.

Note that we will need the normal vector at that very point to enable angle comparison.

There are some factors that modify already specified factors. Read more






button button

Add to Google