0: Foreword
Have you ever admired Slartibartfast who built planets and designed
coastlines? With Terraform you can design the landscape shape however you
want using the height field operations. If you want to change the land's
color, or its texture, and there isn't a template file available to your
liking, you can write your own. Terraform comes with a few templates
describing the texture of the land and its surrounding celestial bodies.
These templates are in the form of *.pov files typically located in the
/usr/shared/terraform directory. The template files can be sampled by
right clicking on a Height Field and then clicking HF > Render Options
> PovRay > POV template file. The ones included at the time of this
writing are: bare_rock, earth_basic, earth_canyon, and earth_green.
This document covers how to design your own template file and assumes
you already understand povray scene file syntax, have looked at a
povray file exported by Terraform. Also, it'd be a good idea to
look over defaults.inc as a reference describing all the parameters.
1.1: Parameters
There are quite a few parameters Terraform passes to the template
file. The most important of them include: TF_HEIGHT_FIELD, TF_WATER_LEVEL,
TF_X_SCALE, TF_Y_SCALE, TF_Z_SCALE, TF_CAMERA_LOCATION, and
TF_CAMERA_LOOK_AT. The first one is a height field object
declaration, the last two are vectors used for setting up the camera,
and the rest of the parameters in the above list are floats.
Many other parameters are available to the template file, some of
which are booleans. You need not implement every parameter.
3: How the world is set up
The sky spheres, sun, and moon are centered around the origin <0, 0, 0>.
Generally, the distance from the origin to, say, a sun, should always
be proportional to vlength (<TF_X_SCALE, TF_Y_SCALE, TF_Z_SCALE>).
You can always break the rules if a heavenly body has, say, an elliptical
path, but always try and make the ellipse proportional to the aforemensioned
value. Otherwise, changing the scale in Terraform may cause scaling
problems.
3.1: Where is the land and water
The land is centered on the XZ plane from
<-TF_X_SCALE / 2.0, 0.0, -TF_Z_SCALE / 2.0> to
<TF_X_SCALE / 2.0, TF_Y_SCALE, TF_Z_SCALE / 2.0>.
In relation to the actual Targa height field, the lower left-hand corner
of the *.tga file corresponds to <-TF_X_SCALE / 2.0, y,
-TF_Z_SCALE / 2.0>. The sea floor maps to y=0, sealevel maps
to y=(TF_Y_SCALE * TF_WATER_LEVEL), and the highest peak maps
to y=TF_Y_SCALE.
4: Creating your own template
First create a *.pov file and copy these lines into it:
// Include Povray standard include files.
#include "colors.inc"
#include "skies.inc"
// Set any unassigned parameters to their default values.
#include "defaults.inc"
// Override default texture.
#declare TF_LANDSCAPE_TEXTURE = texture
{
pigment { color rgb <0.8, 0.4, 0.1> }
}
// Add an earth sky, sun, moon, and stars.
#include "earth_sky.inc"
// Create water.
#include "earth_water.inc"
// Create the land and camera.
#include "generic_land.inc"
Note that you should declare TF_LANDSCAPE_TEXTURE after #including
defaults.inc. That's because your texture may rely on the TF_WATER_LEVEL
parameter. Next, replace one of the *.pov files in your /usr/share/terraform
directory with this one (you should probably back up the *.pov file before
you overwrite it). Generate a height field and then render it using this
template file. Next you can try modifying the texture to suit your tastes.
Play around with it for a bit. If you are feeling quite comfortable
creating your own landscape textures, try something more difficult,
such as designing a martian sky. Try using the files that come with
Terraform as a starting point for making your own.