PAGE 17

SCRIPTING AND ANIMATION

The Scripter allows you to make animations from Terragen landscapes. You can make animated gifs or avi movie files of fly overs, clouds moving across the sky, or sunsets and sunrises.

terrain and flight path

First we will make a very simple fly over. This terrain shows a landscape of sea and islands, with a flight path marked on it, from the small island at the bottom, across the headland in the centre, to the island at the top of the terrain. Also marked, very close to the fly over line because in fact they are identical at the start, is the sight line for the first frame of the animation. The target, as usual in a Terragen picture, is at the end of the sight line. In this first animation, we shall specify only the start and finish camera position co-ordinates, and the program will calculate the camera position for all the frames. If you specify start and finish only, the flight is as the crow flies, straight along a line joining the start and finish points.

The target position will remain the same throughout the flight, and the effect will be that the first half of the flight will be towards the headland, and the second half will be backing away from it, so that we inspect the headland from both sides.

Below is the render control for the first frame of the animation. It shows the co-ordinates of the starting position and the target position. The island we are starting from is not visible in the preview, since the camera position is right on the edge of it. You can just see the island for the end of the fly over behind the headland. The only thing that will be changed when we come to render the frames is the picture size. You can make large gifs and avis, but they make very large files indeed, and for this tutorial I am making them 240x180.

frame one

The scripter options are on the Terragen menu. Click on the 'Run Scripter' option and the dialogue box will appear.

Scripter

You can see that the number of frames can be specified. Here I have chosen to use 20 frames. The columns on the left hold the camera position co-ordinates for the start, copied from the render control panel. To fill in the camera position for the last frame, left click on the terrain at the camera position for the end of the flight. The co-ordinates for this position appear on the render control panel, and you copy them into the right hand column. We are not moving the sun in this animation so the sun heading is left unchecked.

The name and path for the bitmaps (Frames' filename) and the script must be filled in. There is no suffix to the bitmap name because the program will add the frame number and .bmp to each one before saving it. The .tgs suffix for the script must be filled in, however. When all the details have been entered, click on the 'Create it' button. We shall not be using Notepad to make changes to this first script, so we shall not be using the 'Notepad it' button. The script is saved automatically to the folder specified.

To make the bitmaps, first specify the size of the frames on the render control panel. You must have the correct terrain in place, so if you are not making the animation immediately, terrain and world must be saved, and you must make a note of the water settings.

Then use Terragen/Execute script. You are prompted to load the script and the rendering of the bitmaps will begin immediately. The 20 frames, in bmp format, will be saved to the location you specified when making the script. It does not matter if you do not have the correct camera position on the terrain when you begin, because the script will move to the right position. In fact, you will see the sight line changing as each frame is rendered, getting shorter as it moves nearer to the target position, and then getting longer again after passing the target position.

When the 20 frames are made, you should first check that there are no black lines at the horizon on any frames where sky and land/sea do not quite meet. If there are, they have to be painted or cloned out in a graphics program. Then the frames must either be converted to gifs, and a gif animator such as Paint Shop Pro Animation Shop or Ulead Gif Animator used to make an animated gif, or a video program or codec can be used to make an avi movie file from the bitmaps.

To view the animation, click on the still picture below. The frames will load and the animation will play. You may download the animation if you wish by right clicking on it when it is running and using Save Image As. Use the browser back button to return here. There is a link below at which you can download an .avi copy of this animation. This same procedure will be followed with all the animation examples in this section of the tutorial.

animation 1

Download the .avi file here

I made another animation from the same terrain, but this time, instead of flying across the headland, the flight path is around it. The target position remains the same. The first thing I did was remove the land mass opposite the headland, so that the flight is always over water. I used the middle sculpting tool, holding down the right mouse button to lower the height of that area. This caused the terrain generator to redraw the display, and the impression was given that the levels had been raised throughout the scene. In fact, this is not so. The lowest level is always shown as black. If you change the level of an area to something lower than the existing lowest level, this new area will become black, and the formerly lowest area will be coloured grey. It does not alter the height of any features in your terrain, simply shows the relationship between highest and lowest. You do not need to change the water level to compensate for the fact that your sea or lake is now coloured grey instead of black. It is still at the same height, but you now have an area of even deeper water in your picture.

I still used 20 frames, but had to specify where some of the camera positions would be, to stop the script generated from taking the line we used before, the shortest between the start and finish.

fly round flight path

The entire flight path was divided into four sections - the last position of each section is marked on the terrain map above. The first position of the second to fourth sections is always identical to the last position of the previous one. Four separate scripts were made, and then copy/pasted into one large one. The first three sections had 6 frames each. For the first one I used the original starting position for frame 1, and the position marked as frame 6 for the last one. I raised the camera height (z parameter) for this fly around, and kept the height the same until the very last frame of the last section, so that if the terrain level went up and down, the camera would not, and the animation would be smoother. The terrain at the final position was higher than this camera height, so I used the terrain height +3 for the final z co-ordinate.

The bitmap name remained the same for all four scripts, but the script name (the one with the .tgs suffix) had to be different for each portion of the script. After running the scripter and creating the first section of script, I changed the script name, used the parameters of frame 6 for the first section as frame 1 for the second, and moved the camera position to the one marked 11 on the illustration, using these parameters for frame 6. This same procedure was followed for the other sections, except that there were only five frames in the last section, since the last frame for that section would not be duplicated.

When all the scripts were created, the first section was loaded into Notepad. In a script there is a header giving the name for the bitmaps, followed by 1 (the frame number), and then each camera position has a line with its co-ordinates and below that the instruction Frend - the instruction to render the bitmap for that frame, using this camera position, the target marked on the terrain map on the render control panel, and any atmosphere, water settings, surface maps etc., currently set in the program.

The second section was loaded into a second copy of Notepad. The header and the first camera position co-ordinates and the first Frend command were not required - Frame 6 was already in the script of the first section - so the rest of the script was selected and copy/pasted at the end of the first section. This was repeated with sections 3 and 4, so that the result was one script with 20 frames, which was saved as a .tgs file.

When rendered using Terragen/Execute Script, the animation below was the result. The flight path is around the end of the headland, and the small island which was the starting point is visible during this flight. It was hidden behind the headland in the first one.

flyaround

Download the avi file here

These have been simple animations in which Terragen generated the scripts and we did not have to make changes or insert commands. We move on now to look at sun and cloud movement, and at the commands available in the Scripter.


PREVIOUS PAGE   CONTENTS PAGE   NEXT PAGE