Helen's images

Terragen tips

These tips are to be used with Terragen. They have to do with things I I didn't know about and had to search and experiment to find out.

They are not full tutorials and they are mostly suitable for a user who is comfortable with the Terragen interface and other graphic programs. I have not found the answers somewhere else, so here they are:

| HDR images and POV-Ray | Animations | Adding buildings etc. | Downsampling |

HDR images and POV-Ray

The Sopack plugin offers the option to save HDR images, as well as the regular BMPs, for each of your renderings AND previews. (be sure to turn it on only when ready to make a final render, or else be prepared to delete a large number of HDR files).

HDR images are images with a much greater range of luminance values than traditional image formats. So, they can be used in 3d and animation programs to simulate real world lighting. Most programs that use HDR are quite expensive, but now the free POV-Ray can also use them; at least a patch for it called ML-POV.

Sopack saves HDR images in the same directory, where your Terragen world is saved, but gives them the name "tgimg" plus random numbers. If you render multiple images (for example for a panorama), you will have to rename the HDR ones with similar names to the relevant BMPs. Just sort the directory files by time modified and the HDR images will have the same (almost) creation time as the BMPs of the same scene.

There is a program called HDR shop (free for non commercial use) with which you can open and edit your HDR images. With this, you can do panoramic transformations. According to the menus, you can take 6 separate images (cubic environment), like those generated by the Jo Meder's pano script (in the files' area of terragen yahoo groups) or the one from Dave Drews and turn them into a latitude/longitude panoramic image, which can then be mapped on a sphere in ml-POV and represent the environment of your POV-Ray scene exactly. Unfortunately, it seems this function is broken in the latest HDR Shop (it only transforms one of the 6 images), so you will have to map the 6 images on 6 cubes arranged to form a cube around your scene. This has the disadvantage of possible distortions, especially in animations, when the camera is moving.

Sean O'Malley, the author of Sopack, has made a handy little program called cube2cross, which takes the 6 hdr panorama images and makes them into a cross, which can then be loaded into HDRShop and changed to a latitude/longitude panorama or a spherical one. There are some points you must watch out for:



In order to make Terragen animations, you need a script (TGS file). These scripts are plain text, so, theoretically at least, you can make your own in Notepad. Practically, anything above 20 frames is not feasible (too much typing and copying and pasting, something that, for me at least, is prone to mistakes). Terragen's scripter can help, if you move your camera in a straight line; it will make your script for any number of frames. It can also animate the sun and other parameters (zoom, exposure and shadow lightness). It is up to you though not to go so low as to get under the mountains or so high that you will see the end of the sky at the bottom :-(
There is a bug in Scripter (more probably in the way that Windows interpret commands involving long path names) that will prevent your scripts from running. To fix it, open your script in Notepad and add quotation marks around your animation files' path and a comma or space after InitAnim (it needs either comma or a space, but works with both).
Look at the first line in the TGS file. You should see something like this:

InitAnim C:\Program Files\terragen\anim\anim,1

Change it to this (depending on your desired path, of course):

InitAnim, "C:\Program Files\terragen\anim\anim",1

Also, the number 1 that you can see at the end of the first line above, tells Terragen which frame to render first, where to start. It may so happen that your animation takes a very long time (days, weeks...) and you need to stop it, to continue some other time. Or you have a computer crash or a power failure and you have to continue the animation later. If you rerun the script, it will start rendering from frame 1, even if you manually erase all the rows with the frames you don't want to render. Changing this number 1 to whatever number frame you want to start from, will solve this problem.

If you want your camera to follow a more complicated path, changing speeds, turning, going up and down and looking around, you will need one of the 2 programs that were made especially for this: Terranim and CamPath.
I have been unable to run CamPath in my machine (maybe because my system is Windows NT), but for those who can, it is considered a very good program. Version 4 is said to be more flexible, but less user friendly (no preview) than version 3.

With Terranim, you can choose some points on your terrain for the camera to go through and the program makes a spline so that the camera movement will be smooth. You can make a similar path for the camera target (look at) or keep it looking straight ahead. You can check with the preview what the animation will look like, and move the points where it goes through a mountain. There is no preview for the end-of-the-sky problem, so the only solution for this is to render a very low detail animation and check for yourself. Terranim at the default speed values and a long path will make very large animations. Check the number of frames (control window). You can change this indirectly by increasing the speed (velocity) at all points of your path (remember to save each change).
Don't forget to set the name and directory for the animation frames (control window), or they will be c:\temp\anim. I have had a number of animations fail to start, just after rendering the first frame, because of a typo in the directory name.
Terranim can also animate the clouds, as well as the sun, unfortunately not with a static camera. For that, you will have to use Scripter, adding the values for cloud animation (where they start and how fast they are going and to which direction) by hand in the TGS file. Fortunately, you only have to add them once. The format for animating the clouds is: (add this just after the first line)

CloudPos, 0, 0
CloudVel, 5, 45

Putting the first value of CloudVel lower than 5, lowers the cloud velocity so much, that for me at least, no cloud movement is visible.

After executing a script with Terragen, you are left with a series of numbered BMP images (if on a PC, different format for a MAC). There are many programs to make them into a movie, simple or complicated, freeware, shareware or commercial. Some of the simpler (and cheaper or free) ones are: Fast Movie Processor (download link on the top of the tutorial page), VideoMach, VirtualDub, TMPGEnc and RaDVideo to name a few. To make a different, smaller video you need the correct encoders/decoders installed and for MPEG, an MPEG converter ( bbMPEG is good - also TMPGEnc mentioned above).


Adding buildings etc.

I know, I know, there are many tutorials on this, so I will be brief:

Terragen, at its present stage of development, does not support the import of objects, so there are many ways to add a building:

The buildings must be added manually to a terrain, usually by a paint program and you have to guess by trial and error how high something is going to be. Keep in mind that you are making a heightfield where black is low and white is high.

There are 2 ways: One is to make the terrain and the buildings in a paint program. This program must support multiple layers (Photoshop, PaintShopPro, Corel Photopaint and GIMP are good for this), so that you will have the terrain in one layer and each part of the building or buildings in a separate layer. You save this image in the paint program's native layer supporting format (PSD, PSP, CPT and XCF respectively) and export a BMP to import into Terragen by FEO. Or, you make the terrain in Terragen or another terrain generating program, export it as BMP by FEO and continue with your paint program as above.

If the layer mode is set to "add", the building will always be higher than the terrain - this might result in strange shaped buildings (good for adding a wall that goes up and down on mountains). If you want your buildings' tops to be level, you must set the layer mode to "lighten only" - this might of course result in half buried buildings.

The second way is to make your buildings only in the paint program and add them to the terrain with Terraformer, World Machine or even with Terragen. This is a little more counter intuitive, but results in smoother terrains, especially for the unregistered version of Terragen, where you cannot use terrains larger than 513X513. If a small terrain goes through export to BMP, it will be pixelated and probably have spikes added.

Adding buildings to a terrain with Terraformer is similar to using a paint program that supports layers. If you use World Machine to add your building, you must set the combining mode to "max".

Some examples of combining:

1st image 2nd image

add subtract lighten darken difference
Add Subtract Lighten only Darken only Difference

a building

In either case, save each part of your buildings in a separate file or layer, so that you can increase contrast, if, for example, you find your building too low, smooth or blur the gradient, if you can see "steps" etc.

When making your world for a terrain that includes buildings, it is wise to first make some masks for your buildings (just the building outline filled with white on a black background) and save as BMPs. Then you can use the Sopack plugin to modify the surface map distribution, so that a texture will only fall on the building.
Also make sure that there is nothing under your building's texture (make your base surface map completely smooth and subtract your building masks from all land textures), or it will distort the shape of your buildings. Unfortunately, neither Terragen or Sopack save the mask settings, so if you close and reopen the file, you will have to reapply all the masks. Give the texture layers meaningful names, so that you will remember which mask to put where.


It is often said that downsampling a Terragen image (that is rendering at a larger size and resizing down with a graphic program, using some sort of smoothing interpolation) improves the details. It is difficult to understand this easily and I thought I would make an image to show it, since I didn't find any clear enough. So, here is my example: It was not made in Terragen, but in POV-Ray, but it was the first time it made me understand the difference.

The scene itself isn't much, since I was just testing the new features of version 3.5 of POV-Ray last September.

The first image was rendered without antialiasing at 640X480. There are more obvious problems with the plants (they were made with Plant Studio ), as they are thin and appear broken.
loss of detail
The second image was rendered at 3200X2400 and downsampled with Irfanview, using Lanczos filter. The image was a little soft after downsampling, so a little sharpening was used for the result below. The difference in plants' details is obvious. Why?
higher detail
The third image shows some detail from the plants left to the ball, as shown in the large image (rendered with antialiasing).

Some reasons I can think of for the difference have to do with antialiasing.
It seems, that when more detail is available and it is downsampled, what we see is an average of the larger detail scene, which to our eyes looks much better, since it comes from an image with more information.
An enlarged (by HTML and not a graphic one) version of the first 2 images will help:

enlarged enlarged
This is the straight rendering with the small detail. This is the downsampled rendering that shows more detail.

| top | Home | Free files | Terragen Start Page |

Last Updated: