Geomorph - The preview dialog

The purpose of the preview dialog

The preview was first intended as a way to see the result of the height field edition in real time.

However, when your goal is to create scenes with Povray, the preview is of limited use if it cannot reflects the Povray camera.

Placing a camera and finding the right angle of view is a difficult task with the Povray language, without a GUI. Even with a real camera, it's sometimes difficult! But as in photography, performing this task adequately is essential for an aesthetic result.

The preview dialog and the Povray scenes provided with Geomorph 0.12 were modified for accelerating this task. The preview viewpoint now translates as Povray parameters which move the Povray camera and change the view angle, each time a scene is rendered.

Drawing inspiration from the provided scenes, you can create your own scenes working with the Geomorph preview.

The coordinate system

Axes The Geomorph preview uses the Povray coordinate system. As seen at right, the Y axis goes from bottom to top, the X axis from left to right and the Z axis from the viewer to the background.

The main features of the preview

The preview dialog features rotations, translations and a view angle control.

Parameters can be changed not only with the GUI controls, but also by moving the mouse into the image.

When you draw with the height field pen, the preview area is refreshed as soon as you release the mouse button.

The parameters can be defined for 5 distinct cameras.

The cameras are saved in the height field PNG file. They are restored when you open the file.

When a new document is created, or when a file is read and does not contain any camera (for instance, a file created with The Gimp), the last cameras displayed during the session are reused. If the document created or read is the first in the current session, the Geomorph defaults are used. Then, the 5 cameras are identical.

Lastly, when a Povray scene is rendered, the parameters of the active camera are recorded in the file, which is called with a #include directive in the scenes provided with Geomorph.

Among the possible enhancements, the optional display of a ground plane and a water plane could be a nice feature. Height of these planes should also be made available to the Povray scenes.

How to use the preview

1 - What can be done with the mouse

It is possible to control the translations and the rotations by dragging the mouse into the preview image.

Left button
Center button
Left / right (X), bottom / top (Y) translations
Right button
Nearer / farther (Z)

2 - Buttons and scales

MAJ Auto
Active: the preview is updated when the height field is modified.
Inactive: the preview is updated when the user clicks "Refresh".
Uncheck this box when Geomorph reacts too slowly. For instance:
(1) The height field being edited is larger than what the computer can support with a smooth interaction.
(2) The level of detail of the preview was increased by a too high percentage.
Refreshes the preview area when "Auto update" is activated, or when the area blackens while switching back and forth between many documents (see the FAQ for the last point).
Increases or decreases the preview area size by 32 pixels steps.
The area width ranges from 64 to 512 pixels. The default width is 128 or 256 pixels. It is deducted from the desktop size when Geomorph starts. The preview area height is 0,75 time the width (the image ratio is 4/3, the same as Povray scenes provided with Geomorph).
Controls the number of vertices created when the height field is converted to triangles, relatively to the number of pixels. For instance, the default value of 25% gives 128x128 vertices for a 512x512 pixels height field. The percentage is divided or multiplied by 2 at each click:  6,25%, 12,5%, 25%, 50%, 100%. The default value of 25% should provide a smooth interaction with the suggested hardware (a ~1000 Mhz CPU for a 512x512 height field, without OpenGL hardware acceleration).
Camera management.
Click on the radio button for the camera you want to activate.
A camera is defined by the rotation, translation and angle parameters.
The 5 cameras are recorded with the height field, in the comments area of the PNG file. Editing the height field with an other tool would probably erase them.  A workaround is proposed for this in the hints section.
The cameras are initialized with the values from the last active document, or if not possible, from the Geomorph default values.
After the initialization, each document keeps its own cameras. A view change in one document does not affect the views of the other documents.
Rotation Y
Rotation angle around the vertical axis (Y), from 0° to 360°.
Rotation X
Rotation angle around the West-East axis (X), or slant forward - backward, from 0° to 360°.
When the view angle is set at 60°, the skyline appears from 22° downwards. A slant of 6° gives a skyline at roughly 2/3 of the image.
Note: the preview doesn't provide a rotation around the Z axis. This would give a slanted skyline.
Déplacement Z
Relative distance between the observer and the terrain. 0 means the center of the height field.
Déplacement Y
Vertical translation of the height field, from -Y to +Y.
Déplacement X
Lateral translation of the height field, from -X to +X.
Hozontal angle of view, from 5° to 100°, respecting the Povray standard. With photographic cameras, the view angle given for the focal length of the lens is most often diagonal. Here is a correspondance table for common focal lengths:
35 mm Focal
Horizontal Angle
Diagonal Angle
24x36 Format
(Ratio 3/2)
15 mm
20 mm
24 mm
28 mm
35 mm
50 mm
80 mm
100 mm
200 mm
400 mm
The "normal" lens for 35 mm photography has a 50 mm focal length, corresponding to 40° in Geomorph. The default angle in version 0.12 of Geomorph is 55°.
The diagonal angle of Geomorph/Povray would be slightly more than the one given in the table, because the image ratio is 4/3 instead of 3/2.
Remetre à 0
This button resets the active camera to the Geomorph defaults.

The structure of a Povray scene working with the preview

The link between the preview and a Povray scene is done with the file, generated in the current Geomorph directory when a scene is rendered. This file creates the variables used for adjusting the Povray parameters. Here is the related to the default Geomorph camera:

#declare gl_angle = 55;
#declare aspect_ratio =  1.3333334;
#declare tr_x = -0.0000000;
#declare tr_y = -0.0000000;
#declare tr_z = -1.3500000;    // The OpenGL -> Povray conversion requires this adjustment
#declare rot_x = 50;
#declare rot_y = 0;
#declare rot_z = 0;
Here is an the general look of a Povray scene matched with the Geomorph preview (variables coming from appear in bold):

#include ""
#include ""
#include ""

#declare maincamera = {
    location  <0,  0, -0.1>
    angle     gl_angle
    up        y                
    right     aspect_ratio * x
    look_at   <0, 0, 0>    
#declare sun = light_source { <-300, 300, -10> color White }
#declare water = plane {y,0 texture (...) }
#declare ground =
plane {y,0 texture (...) }
#declare Sky = [plane / sphere] {...}    // "sky" without a capital is a reserved word
#declare hf = height_field {
    png "test.png"  // Standard output file when rendering from Geomorph
    scale <1.0, 0.3, 1.0>    // Y = 0.3x, otherwise the terrain is as hight as wide (unnatural!)
    translate <-0.5, 0.0, -0.5>    // Without this translation, a corner of the HF appears at the center
    texture (...)

object {hf translate <...> rotate <...> scale <...>

// For "water" and "ground":

//    (1) for an infinite plane, the scaling acts only on the texture.

//    (2) the "y" translation must sometimes be very slight, around 0.01,
//        if we want the plane to adjust smoothly with the HF

object {water translate y*0.0005 scale <...> } // preferably the water should be over the ground!
object {ground translate y*0.0 scale <...> }

light_source {sun rotate <0, rot_y, 0>    // The Povray light follows the point of view change
// It could also make some sense to apply "rot_x" to "sun"

object {Sky rotate <??, ??+rot_y, ??>}
// The rotation aligns the preferred area of the sky (clouds) with the camera
// (if you have a preferred area!)

camera {maincamera
        translate <0+tr_x,0.05+tr_y,tr_z>
        rotate <rot_x,0+rot_y,0+rot_z> }

To override a parameter, simply replace the variable name with the desired value. This could make sense, for instance, if you want another aspect ratio than 4/3, because it cannot be set in the dialog.

Some hints
  1. How to make small changes to the scale values
It is sometimes difficult to set the distance or rotation scales. For instance, the forward - backward slant requires often angles between 0° and 10°. You get a fine control by 1° steps by clicking on the scale cursor with the mouse, then moving the cursor with the left - right arrows of the keyboard.
  1. How to obtain a skyline at the third of the image
A 6° forward - backward slant with a 60° camera gives a skyline at 2/3 of the image (1/3 sky, 2/3 ground). Sometimes, you'll want to show 2/3 sky, for intance when the clouds are interesting. Then use a slant between 350 and 355°, and moves the camera towards the bottom (the HF towards the top). An example: a X rotation of 352°, a Y translation of -0,31.
  1. The refreshment is too slow
If the preview computation slows down the interface too much, decrease the detail level, or uncheck the "Auto update" box.
  1. How to copy and reuse the camera parameters
Geomorph doesn't provide, with version 0.12, a camera parameters saving at the session level. However, if you want to reuse your preferred points of view over and over, save them in a document that you'll open each time you'll start Geomorph. The cameras of the file most recently open are reused when new documents are created.
  1. How to restore the camera parameters after editing with an external software
Maybe you'll want to edit your PNG HF files with The Gimp, or better, for keeping the fine detail of the relief on 16 bits, with Filmgimp/Cinepaint. The cameras are kept inside the comments field of the PNG file. This information is not kept by the other software tools. However you can proceed like this to save and restore it:
  1. Copy the file under a new name.
  2. Edit the original file with the external software.
  3. When coming back into Geomorph, open the unedited copy. Geomorph would initialize the 5 cameras with the parameters found in the file. 
  4. Open the modified document. Because Geomorph wouldn't find any camera definition in it, it would reuse the parameters found in the copy.
  1. Playing with the angle of view
It may sound unnecessary to provide a view angle scale, when it is possible to get nearer or farther to the heigth field if we want to increase or decrease its relative size.

This is a matter of perspective. For instance, define two cameras, pointed on a hill a the foreground. One has a small angle (it's a telephoto lens), the other has a wide angle. Draw the nearest one farther, and the farthest one nearer, until the hill has the same size in both views. You'll see that the background hills are a lot smaller with the wide angle view than with the tele view.

The wide angle gives a depth effect, while the tele lens gives a flattening effect.

Most often, mountains seem higher when seen through a tele lens, because they take up a larger area of the image.

Use of a wide angle to get a depth effect usually involves translating the camera very close to the object. It can give the feeling that details are lacking, or worst, triangles making up the surface can be seen. A way to minimize this effect is to use a rich Povray texture, specially one with a normal component.
Back to top

Written in November, 2003

Back to the documentation index Logo