PAGE 18

SUN, CLOUDS, AND FLYING ALONG

So far we have not examined the script itself. There is no need for me in this tutorial to set out in detail how a script is constructed, because in your Terragen program folder you will find a file called example.tgs. If you load that into Notepad, it tells you exactly what goes into a script, and what commands are available. We are going to concentrate on the commands involving camera and target position, and sun and cloud movement. The same principle can be applied to camera heading, pitch and bank, (to change the direction of the camera's viewpoint, and whether it is tilted forward or back or to one side); zoom, (to zoom in on the target position or pull back from it); exposure (to lighten or darken the scene) etc.

The first animation moves only the clouds in the sky. Camera and target position are static, as is the sun's position. There are no buttons on the Scripter control panel for cloud movement, so this script has to be written in Notepad, following the instructions in example.tgs. It must begin with the initiation command InitAnim, in which the path and root name of the frames is specified, followed by the frame number for the first frame. When you are writing a script, your path will be different, but I specified that the frame bitmaps were to be stored on drive F, in F:\terrains\anim and that the first bitmap was to be called pic9a001.bmp (the 1 after the comma will determine that the number added to the root name pic9a for the first frame is 001. It will be incremented with every frame).

Then comes the command CloudVel. Its first parameter specifies how fast the clouds are to move - i.e. how far across the sky they must have moved by the next frame. The second parameter is the heading, you change that if you want the clouds to move in a different direction, or to come towards or away from the camera. The angle the clouds move across the picture will depend on the sight line. 45 goes along a line from bottom left to top right across the terrain. In this animation the sight line is at right angles to that and the clouds appear to move from left to right.

If you are making a big script broken down into several parts, you can use the command CloudPos, with the x,y co-ordinates of the cloud position for the first frame. That is entered into every block of script, along with CloudVel, and although you may be starting with something other than frame 1, the program will calculate where the clouds should be at the current starting frame, calculating from their original position on the first frame. When you come to put all the bitmaps together in the movie, the cloud movement will be smooth even though the frames were made from different scripts.

But for this short animation, I am using only the velocity and direction. Frend renders one frame, then the cloud position changes before the next Frend is executed. You can use this script with virtually any terrain, world and atmosphere settings. The clouds will not go right across the sky unless you enter more than 16 Frends, but I wanted to keep the animations in this tutorial small enough for a reasonable download time. At home you can use more frames and achieve greater realism.

InitAnim F:\terrains\anim\pic9a,1

CloudVel 10, 45

Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend
Frend

Click on the still frame to see the animation, and use the browser back button to return here afterwards.

cloud movement
Download the avi file here

In the next example the sun will move, and so will the clouds. The sun will move across the sky and set, while the clouds also move across the sky. To make the script for this one, the sun heading was checked in the Scripter, and the camera position unchecked, since the camera was not going to move.

For the first frame, the sun direction was 180 and the sun altitude 23.532. There were 10 frames and for the last one, the sun direction was 232.958 and the the sun altitude 1.353. So in the course of the 10 frames, the sun would move some 53 degrees across the sky and drop to almost horizon height. Because there is no way a sunset covering this much sky can be made to look realistic in 10 frames, I deliberately made the animation jerky, like a time delay photograph sequence.

The scripter produced the list of sun positions and heights for the frames, and inserted the Frend commands, but I also wanted to move the clouds, and there is no button for cloud commands. The Notepad It button is there for exactly this purpose - amending a newly written script, and adding commands which are not available as buttons on the Scripter dialogue. It presents the new script in Notepad, and the CloudVel 10,45 instruction was inserted above the first SunDir command, and the script resaved. In this animation, the sight line is almost along the diagonal line across the terrain, but in the opposite direction to the cloud movement, so the clouds appear to be moving towards the camera. This was the animation produced by this script.

sunset

Download the avi file here

For the final example in this section, I want to look at a fly past when both camera and target positions move. Our previous flights were slightly unnatural because the target position was fixed. Normally as you move along the view is unfolding before you. This is what will happen on this flight.

fly pastThis illustration shows the camera position flight path, from position 1 to position 2, marked in blue, and the target position flight path marked in red. The normal sight line for the opening frame links the two positions 1. (These three lines should be on top of one another, but I have shown them alongside each other for clarity. They actually follow the same line).

Since there is no provision for changing target positions in the Scripter, we must first determine the parameters for all the target positions in the flight. So the first script will have the first and last target positions named as the first and last camera positions. This is rendered and saved as usual. Then a second script is generated, with the camera position parameters used as the first and last camera positions. When this script is finished, Notepad It is used. The first script, with the target positions, must be loaded into a second copy of Notepad, and its list of parameters copied into the new script with the command TarPos, one under each corresponding CamPos command and parameters. This modified script is then saved, and it is the one which is executed to make the frames.

This is the type of animation produced by this method. As you see from the terrain, it passes over three lakes each divided from the next by a strip of land. The camera position height is 3 above the terrain height, so there is an impression of flying straight towards a cliff ahead, but rising up enough to skim over it.

fly past

Download the avi file here

Other options, like camera head position, bank, zoom etc., have to be entered into the Script in the instructions for every frame, using Notepad It. Only CloudPos and CloudVal are entered as global values at the start of the script. Each of the other commands has only one parameter. You may need to experiment, rendering previews of individual frames, to see the effect of, say, different bank settings when your flight makes a turn, to give the impression of an aircraft banking as it turns, and make a note of the settings you judged to be best, so that you can insert them into the finished script.

The remaining options on the Terragen menu are Preferences and Run Terranim. Preferences at the time of writing offers monitor gamma adjustment. Terranim is a Terragen Script generating program by Daniel Parnham. If you download Terranim and copy it to the Terragen folder, it can be called from this option. I have not covered Terranim in this tutorial since it is a separate program with its own instructions, but it can be obtained here

Download Terranim

We now move on to the final page of the tutorial, to complete the still picture we have been building up throughout it.

PREVIOUS PAGE   CONTENTS PAGE   NEXT PAGE