Texturing a Geomorph height field
with Povray


maprock1.inc
geomorph_txtr.inc
slope_patterns.inc
painted_desert_map2.inc

The textures of a terrain are of great importance for achieving realism. They are almost as important as the terrain shape given by the height field.

This section presents the textures available in the Povray include files provided with version 0.23 of Geomorph.

The content is intended for non-experts, who have read at least an introduction to Povray and the Anatomy of a Povray file for using Geomorph.  The examples provided show only the parts of the scene file relevant to texturing, so the reader must at least specify the camera and the light, for instance by using one of the Geomorph scene templates. For convenience, the test scene file is provided here - just check the parameters and what lines have been unactivated by using comments marks (// or /*...*/). The include files documented in this page and distributed with Geomorph 0.23 can also be found here.

All the examples in this page use variables, whose values can be set by the user. The use of some textures could seem complex at first glance because there are a lot of values to set, but almost all of these variables are optional and can be omitted.

This is a work in progress, resulting from a trial-and-error process. Some of these textures may change in future releases.

Version 0.40 and later
- geomorph.inc may be used instead of maprock1.inc, geomorph_txtr.inc and slope_patterns.inc. This file includes the 3 others.
- When geomorph.inc is used, all png "test.png" commands in this page should be replaced by png main_terrain


Pigments and normals

The look of any texture mainly depends on its colour, given by the pigment keyword, and on its surface "sense of touch", given by the normal keyword.

Most Povray textures provided by Geomorph have a pigment and a normal components. The intensity of both components can be set by the user.

To get an intuitive understanding of what is a normal, check the "Sea and moon" tutorial. The Moon craters are created as a normal, which simulates the surface deformation. There is no actual deformation, you won't see any hole or mountain on the sphere border.

The include files index

maprock1.inc

Provides a colour map, generally used with a gradient pattern for simulating sedimentary rock. It can also be used to simulate clouds bands on a giant planet. The user may change the basic coulour, so that the bands represent only a density variation on that colour.
You can generate your own map with the "colmap" program (explained later).
geomorph_txtr.inc

Provides sand, grass and granite textures. Contains the "wet granite" texture used in the "cracks" tutorial.
slope_patterns.inc

Provides rock, forest, snow and bushes textures, with a slope component. The snow appears at higher altitudes, and the forest, the bushes or the snow disappear in favour of bare rock when the slope is too steep.
painted_desert_map1.inc
painted_desert_map2.inc
painted_desert_map3.inc

 
These files define pastel reddish colour maps under the name ground_map, for use as gradients simulating the colours of the Painted Desert, in Arizona. These are actual colours, sampled on Kodachrome slides taken 2-3 hours after the sunrise. The col_density variable can be used to adjust the overall density of the colours.

Geomorph also provides the files uranus.inc, which creates a Uranus-like planet with thin rings (and unrealistically saturated colours!), and stars.inc, which gives a simple star texture to be used on a sky sphere.

Examples of maprock1.inc use

The file maprock1.inc provides only a colour map, suitable for building a pigment.

Dark colours were used in these examples for producing an earthy look.

Use
Result
Basic:
#declare rock_color=<0.55,0.45,0.3>; // Mandatory
#include "maprock1.inc"
...
height_field {
png "test.png"
smooth
texture {pigment {gradient y color_map{rock_map} scale 0.5} }
scale < 1.0, 0.3, 1.0 >
translate <-.5, 0.0, -.5>
}

Here we scale the texture to 0.5, which means the bands are repeated once (2 cycles), otherwise they are difficult to see.

Basic, for the sphere:
#declare rock_color=<0.55,0.45,0.3> ;
#include "maprock1.inc"
...
sphere { <0,0,0> 1
texture {pigment {gradient y color_map{rock_map}} }
}

See how the texture is repeated. There is a neat border at the equator. If you want the full gradient without repetition, translate it by 50% and stretch the gradient on the y axis by 200%:
texture {pigment {gradient y color_map{rock_map}} translate 0.5 scale 2 }

Add turbulence, use another colour:
#declare rock_color=<0.5,0.5,0.2> ;
#include "maprock1.inc"
...
sphere { <0,0,0> 1
texture {
    pigment {gradient y color_map{rock_map}
    warp {turbulence 0.1}
    } // end of pigment
}
}

Here the gradient is reused as a normal. We #declare the pigment in a variable to make easier to reuse it:
#declare strata = pigment {gradient y color_map{rock_map} warp {turbulence 0.1}}
sphere { <0,0,0> 1
texture {
    pigment { strata }
    normal { pigment_pattern {strata} 1.5 } // 1.5 is the bump size
}
}

Now we reuse the pigment as a normal on a terrain, to emphasize the sedimentary layers:
#declare rock_color=<0.55,0.45,0.3>
;
#include "maprock1.inc"
...
#declare strata = pigment {gradient y color_map{rock_map} warp {turbulence 0.1}}
height_field {
png "test.png"
smooth
texture {pigment {strata} normal {pigment_pattern{strata} 1.0} scale 0.3}
scale < 1.0, 0.3, 1.0 >
translate <-.5, 0.0, -.5>
}
A bump size of 1.5, like the one used for the sphere, was a bit too strong.

The colour map can also be used with other patterns than a gradient.
...
#declare strata = pigment{granite color_map {rock_map} }
sphere { <0,0,0> 1
texture {pigment {strata} normal{pigment_pattern{strata} 1.0 }}
}


Creating new maps with colmap

You can generate other random maps with the colmap program, which can be found in the Geomorph root scenes directory (/usr/local/share/geomorph/0.23/scenes for version 0.23) or downloaded here (source).

I suppose that you copied it in your current directory (or prefixed the name with its full path when running it). The basic use is:
./colmap 35 50 75
... where 35 is the number of values (bands) you want, 50 is the random variation in % of the width of each band, and 33 is the random density variation in %.

If colmap exists but refuses to run, check if it's executable. If not, change its permissions:
chmod u+x colmap

The output would be on the console. Redirect it in the file of your choice:

./colmap 35 50 75 > my_file.inc

Textures from geomorph_txtr.inc

geomorph_txtr.inc
contains the textures designed when writing the tutorials, except those depending on the slope, which are in slope_patterns.inc. These examples show the textures available with Geomorph 0.23.

Texture and use
Result
sand1: Desert or sea bottom sand with a wavy normal; better used on a ground plane or on a smooth terrain. Here the terrain has been smoothed with a radius of 30, then the contrast has been decreased at a level of -35.

#declare sand_color=<0.75,0.55,0.35>; // Optional; if non existent, this colour is the default
#include "geomorph_txtr.inc"
...
#declare hf=
height_field {
    png "test.png"
    smooth
    scale < 1.0, 0.3, 1.0 >
    translate <-.5, 0.0, -.5>

}
...
object  {hf 
texture {sand1 scale 0.01 rotate y*45} }

Notice how the texture is scaled down to show the waves.

shore_granite: A complex texture used for the cracks tutorial. The bottom simulates wet granite. At the waves level, there are algae, going from yellow to green. At the top, there can be some grass, depending on the texture scale.

#declare granite_density=1.5; // Optional. Declare only if you want a value different than 1.2 (ex. 1.5 for a lighter texture, 1.0 for a darker one).
#declare granite_ambient_finish = 0.0; // Optional. Increase to get smoother shadows. Default is 0.2.
#include "geomorph_txtr.inc"
...
#declare hf=...
// See the preceding example
...
object  {hf  texture {shore_granite} }

granite_1:  A granite simulating cracks with a normal. Density can be specified. Notice the variable name: granite1_density instead of granite_density. The 512x512 terrain has been smoothed with a radius of 30 pixels.

#declare granite1_density=1.0;  // Optional; default is 1.0
#declare granite1_grain_scale=1.0; // Optional; default is 1.0;
use value > 2 to see a real difference
#include "geomorph_txtr.inc"
...
#declare hf=...
...
object  {hf  texture {granite_1 scale 0.5} }

granite_2:  A component of the shore_granite texture. With a large scale, it gives a non-grainy bumpy rock. Density can be specified with the granite_density variable.
#declare granite_density=1.5;  // Optional; default is 1.5

#include "geomorph_txtr.inc"
...
#declare hf=...
...
object  {hf  texture {granite_2 scale 0.5} }

granite_2: Now with a small scale.
#declare granite_density=1.5;  // Optional; default is 1.5
#include "geomorph_txtr.inc"
...
#declare hf=...
...
object  {hf  texture {granite_2 scale 0.02} }

t_grass: A grassy texture composed of the p_grass pigment reused as a normal.
#declare grass_density=1.0; // Optional; default is 1.0
#declare grass_scale=1.0; // Optional; default is 1.0; you can specify it directly in the texture
#include "geomorph_txtr.inc"
...
#declare hf=...
...
object  {hf  texture {t_grass scale 0.5} }
Or:
object  {hf  texture {pigment {p_grass} normal {pigment_pattern{p_grass} 1.0} scale 0.5} }


 
Textures from slope_patterns.inc

Povray v. 3.5 and higher offers a new "slope" pattern, for pigmenting or texturing a surface depending on its slope.

For instance, it is now possible to replace a grass, bushes or forest texture with bare rock when the slope of a height field becomes too steep.

The same feature can also be used to simulate the adhesion or "stickiness" of snow on a terrain.

This section present the textures developped for using this new feature. The first ones like "forest" and "snow" are simple textures which serve as building blocks for more complex slope-dependent textures.

Notice that slope_patterns.inc reuses maprock1.inc, already seen. It's why you'll see the rock_color variable.

The smooth height field used is the standard "subdivision 2" generated when Geomorph starts, smoothed with a radius of 30 pixels. The contrast has also been decreased with a level of -35. It it available here. Camera 2 is used.

The eroded height field is also the standard "subdivision 2" one, eroded with the "rain erosion" tool, "crested" with 3 steps then rotated. It is available here. Camera 5 is used.

1. forest

A dark texture made with bumps which look like trees from far away. The colour is sampled from a picture of the Québec boreal black spruce forest, so you'll probably want to increase its brightness to reproduce deciduous tree.

A sharper look can be produced by setting the optional UseGranite variable to 1 (right side of the image).

#declare forest_color_density=1.2; // Optional. Default value is 1.0, which is adequate in a gradient, but looks too dark when the texture is used alone as here
// Increase further more for simulating deciduous trees

#declare forest_normal=1.0;
// Optional. Increase to emphasize the bumps, decrease to smooth them
#declare forest_normal_scale=1.0;  // Optional. Relative size of the bumps.
#declare UseGranite=0 ; // Set to 1.0 for using a granite pattern instead of bumps, for a "sharper" look
#include "slope_patterns.inc"
...
#declare hf=
height_field {
    png "test.png"
    smooth
    scale < 1.0, 0.3, 1.0 >
    translate <-.5, 0.0, -.5>
}
...
object {hf texture {forest}}
// You'll probably want to scale up or down the texture, depending on the terrain (ex. {forest scale 1.5}, or use the forest_normal_scale variable)

2. bushes

When altitude or slope increases, the trees become sparse. They are replaced with bushes, which often look lighter than trees.

UseGranite also works for this texture.

#declare bushes_color_density=1.2; // Optional. Default value is inherited from forest_color_density.
#declare bushes_normal=1.0;
// Optional. Bumps strength.
#declare UseGranite=0 ;
#include "slope_patterns.inc"
...
#declare hf=... // Same as above
...
object {hf texture {bushes}}

3. snow

A standard snow texture, with slight bumps. Hint: try to scale up the bumps to see the difference. The default scaling is suitable for a distant point of view, typical of mountain landscapes, so the bumps look somewhat grainy.

#declare snow_density=0.8; // Optional. Default value is 1.0. When there are no haze or clouds, with a value of 1.0, the highlights seem "burned"
#declare snow_color=<0.95,0.95,1.0>;
// Optional. The default value is shown - a blueish white.
#include "slope_patterns.inc"
...
#declare hf=... // Same as above
...
object {hf texture {snow}}

4. gradient_rock_snow

This texture gives a rocky terrain with snow on top, independently of slope. The rock colour, normal, scale and turbulence, and the snow colour, density and height can be controlled. All variables are optional.

Hint: if you don't want the sedimentary bands, scale the rock pigment (rock_pigment_scale) with a high value like 10. Increase the rock_normal to 1.5 or 2 to emphasize the graininess of the rock.

The left side of the image presents the result when using the default parameters, the right side presents the result when the sedimentary bands are scaled up by 10, so that they don't show, and the graniness is increased by scaling up rock_normal to 1.5.

// Snow control
#declare snow_density=1.0;

#declare snow_color=<0.95, 0.95, 1.0>;
#declare snow_height=0.5;
// Relative height of the snow top. Default value is 0.5.
// Rock control
#declare rock_normal=1.0;
// Bands and grain strength
#declare rock_color=<0.7,0.6,0.3>; 
#declare rock_scale=1.0;
// Global scale
#declare rock_pigment_scale=1.0; // Use to scale only the bands, without the grain
#include "slope_patterns.inc"
...
#declare hf=... // Same as above
...
object {hf texture {gradient_rock_snow}}

5. gradient_forest_snow

An other simple gradient, with forest and snow separated by a smooth layer of bushes.

All the parameters already seen for forest and snow can be controlled.

// Snow control
#declare snow_density=1.0;

#declare snow_color=<0.95, 0.95, 1.0>;
#declare snow_height=0.5;
// Forest control
declare forest_color_density=1.0;
#declare forest_normal=1.0;

#declare forest_normal_scale=1.0;

// Bushes control
#declare bushes_color_density=1.0;
#declare bushes_normal=1.0;

#declare bushes_normal_scale=1.0;

#declare UseGranite=0 ;

#include "slope_patterns.inc"
...
#declare hf=... // Same as above
...
object {hf texture {gradient_forest_snow}}

6. gradient_forest_bushes

Gradient (5) variant, without snow.

Here the bushes colour density has been increased to 1.1 and the forest colour density decreased to 0.9, to emphasize the contrast between the two layers.

The UseGranite variable can also be used for this texture, to replace the bumps pattern by the "sharper" granite one.

Hint: to increase the height were the bushes begin, scale up the texture (as shown). To decrease the height, scale up the texture and translate it down on the Y axis. In the last case, the scaling is required to avoid a "cycle" - when the bushes layer is repeated at the foot of a mountain, or the forest layer at the top.

Scaling up the texture also scales up the normal (the forest and bushes grain). To get a constant grain, scale down the <...>_normal_scale variables by the same ratio, as shown.

// Forest control
declare forest_color_density=0.9;
#declare forest_normal=1.0;

#declare forest_normal_scale=1.0/1.5;

// Bushes control
#declare bushes_color_density=1.1;
#declare bushes_normal=1.0;

#declare bushes_normal_scale=1.0/1.5;

#declare UseGranite=0;

#include "slope_patterns.inc"
...
#declare hf=... // Same as above
...
object {hf texture {gradient_forest_bushes scale 1.5}}

7. slope_snow_rock

Our first slope dependent texture. The steepest parts show bare rock, other parts are covered with snow. The adhesion parameter controls the snow coverage (0.0 -> no snow; 1.0 -> snow everywhere).

// Snow control
#declare snow_density=1.0;

#declare snow_color=<0.95, 0.95, 1.0>;

// Rock control
#declare rock_normal=1.0;
/ / Bands and grain strength
#declare rock_color=<0.7,0.6,0.3>; 
#declare rock_scale=1.0; // Global scale
#declare rock_pigment_scale=1.0; /
/ Use to scale only the bands, without the grain
// Snow adhesion or "stickiness"
#declare adhesion=0.6;
// The default value is 0.5
#include "slope_patterns.inc"
..

#declare hf=...
...
object {hf texture {slope_snow_rock}}

8. slope_forest_rock

Same concept as slope_snow_rock, with bushes and forest instead of snow. The adhesion variable is used in the same way.

Usually, the trees don't grow on the steepest slopes of mountains. They are progressively replaced by bushes or grass, which are replaced with bare rock when the slope increases. So, the adhesion of the forest component is less than the adhesion of the bushes component, even if both are controlled with the same variable.

// Rock control
#declare rock_normal=1.0;
/ / Bands and grain strength
#declare rock_color=<0.7,0.6,0.3>; 
#declare rock_scale=1.0;
// Global scale
#declare rock_pigment_scale=1.0;
// Use to scale only the bands, without the grain
// Bushes control
#declare bushes_color_density=1.0;
#declare bushes_normal=1.0;

// Bushes / forest adhesion or "stickiness"
#declare adhesion=0.5;
// The default value is 0.5
#declare UseGranite=0;
#include "slope_patterns.inc"
..

#declare hf=...
...
object {hf texture {slope_forest_rock}}

9. slope_rock_bushes

This texture, very similar to slope_snow_rock, features only bushes on rock, depending on the slope.

// Bushes control
#declare bushes_color_density=1.0;
#declare bushes_normal=1.0;

// Bushes adhesion or "stickiness"
#declare adhesion=0.5;
// The default value is 0.5
#declare UseGranite=0;
#include "slope_patterns.inc"
..

#declare hf=...
...
object {hf texture {slope_rock_bushes}}

10. rock_top_snow

This texture depends on both the altitude and on the slope. It combines (4) gradient_rock_snow and (7) slope_rock_snow.

// Snow control
#declare snow_density=1.0;

#declare snow_color=<0.95, 0.95, 1.0>;
#declare snow_height=0.4;
// Rock control
#declare rock_normal=1.0;
/ / Bands and grain strength
#declare rock_color=<0.7,0.6,0.3>; 
#declare rock_scale=1.0; // Global scale
#declare rock_pigment_scale=1.0; /
/ Use to scale only the bands, without the grain
// Snow adhesion or "stickiness"
#declare adhesion=0.5; // The default value is 0.5
#include "slope_patterns.inc"
..

#declare hf=...
...
object {hf texture {rock_top_snow}}

11. forest_rock_snow

This texture adds a snow gradient to (8) slope_forest_rock. The snow depends only on the altitude, not on the slope.

// Snow control
#declare snow_density=1.0;

#declare snow_color=<0.95, 0.95, 1.0>;
#declare snow_height=0.5;
// Rock control
#declare rock_normal=1.0;
/ / Bands and grain strength
#declare rock_color=<0.7,0.6,0.3>; 
#declare rock_scale=1.0; // Global scale
#declare rock_pigment_scale=1.0; /
/ Use to scale only the bands, without the grain
// Snow / bushes / forest adhesion or "stickiness"
#declare adhesion=0.7; // The default value is 0.5

#declare UseGranite=0;
#include "slope_patterns.inc"
..

#declare hf=...
...
object {hf texture {forest_rock_snow}}

12. forest_rock_snow_bushes

This is the (11) forest_rock_snow texture, with a slope component for the snow.

// Snow control
#declare snow_density=1.0;

#declare snow_color=<0.95, 0.95, 1.0>;
#declare snow_height=0.5;
// Rock control
#declare rock_normal=1.0;
/ / Bands and grain strength
#declare rock_color=<0.7,0.6,0.3>; 
#declare rock_scale=1.0; // Global scale
#declare rock_pigment_scale=1.0; /
/ Use to scale only the bands, without the grain
// Snow / bushes / forest adhesion or "stickiness"
#declare adhesion=0.7; // The default value is 0.5

#declare UseGranite=0;
#include "slope_patterns.inc"
..

#declare hf=...
...
object {hf texture {forest_rock_snow_bushes}}


Textures from painted_desert_mapN.inc

Geomorph 0.23 offers 3 colour maps, sampled from pictures of the Painted Desert, in Arizona. These maps are recalled by using the identifier ground_map in a pigment.

The examples shown are produced with the eroded height field used for slope_patterns.inc and with the same scene file.

The height field has been edited to widen the mountains tips. First, the height field values were reverted, then the "crest" tool was used on the reverted height field with something like 3 or 4 steps, and finally the image was reverted back.

You can also use the new scene template painted_desert.pov, included in the distribution. This scene calls the second include file. To emphasize the roundness of the eroded summits, the terrain is stretched on the X and Z axis ("scale <2,1,2>").

1. painted_desert_map1.inc

Notice how the texture is adapted to the height field Y scale of 0.3, by scaling it down to 0.35.  The texture is slightly larger to avoid a "cycle" (when the top layer is repeated at the bottom, or the opposite). The layers are not flat because a turbulence factor of 0.1 is used, so there can be some "overflow" of the top layer into the bottom one or the opposite if we don't overscale the texture.

#include "painted_desert_map1.inc"
...
#declare hf=
height_field {
    png "test.png"
    smooth
    scale < 1.0, 0.3, 1.0 >
    translate <-.5, 0.0, -.5>
}
...
object {hf
texture {
    pigment {gradient y
        color_map {ground_map}
        translate y*-0.1
        turbulence 0.1
        scale 0.35
    } }
}

2. painted_desert_map2.inc

#include "painted_desert_map2.inc"
...
// The balance of the scene is exactly the same, whatever "Painted Desert" include file is used.

3. painted_desert_map3.inc

#include "painted_desert_map3.inc"
...



Top

Written in May 2005

Contact:    Patrice St-Gelais

Back to the documentation index


SourceForge.net Logo