Before you begin this tutorial:download the tutorial files
IMPORTANT REMARK!
Before beginning with this tutorial it is necessary to understand the Terrain and camera scripts!
And also a working knowledge of the following three programs is expected:
- Forester by Stephen Dartnall
- Terragen by Matt Fairclough
- Blender by Ton Roosendal
The Forester2Blend script combines the power of them!!
1. A WORD ABOUT FORESTER
Forester is a complete 3D landscape generation and visualisation tool written by Stephen Dartnall .
Forester creates scene description files that are rendered using POV-Ray (an excellent freeware ray-tracing program).
Forester uses a number of object placement algorithms to position hundreds or thousands of objects onto the landscape terrain, each one rotated and/or scaled differently to help hide the fact that the same objects are being used repeatedly.
For example, a dense forest could quickly be placed over a hillside, using a series of basic probability tests to define the location of each tree. It will prevent trees from growing underwater or on steep slopes, and can position them so that they don't grow too close together or too far apart. It can also take into account the altitude to reduce the chances of trees growing higher up the slopes.
And since version 1.00 Forester can export objects locations. This make it possible to use the Forester object placing algorithms in your favourit 3D software, in our case Blender .
2. PREPARING THE BLENDER OBJECTS
The Blender objects we want to be copied must fulfil certain conditions:
- name of the mesh and the object (edit button F9) must be equal:
NOT ME: Cone4 and OB: Cone BUT ME: Cone4 and OB: Cone4
- no automatic names generated by Blender (name.###):
NOT ME: Cone.004 and OB:Cone.004 BUT ME: Cone4 and OB: Cone4
- for objects made of other objects (e.g. the tree we are going to use in this tutorial):
- See that all the objects their origin are located in the same place. Otherwise when copied by Forester2Blender the objects will lose their original place and the final composed object will be mutilated.
You can do this in the Edit button menu (F9). Place the cursor with the leftmouse button in a logical place (e.g. bottom of the tree) and relocate the center off all the seperate objects with the button Centre Cursor .
- Check that the axis orientation are the same for all the composed objects. Otherwise the copy action will alter the orientation of the objects!
- Check that all the objects are sized and rotated in editmode. Otherwise the copy action will resize and rotate your objects when copied with the Forester2Blend script.
3. THINGS TO BE DONE IN TERRAGEN
- Start Terragen and create a heightfield. Save it as a .ter file (web.ter).
- Create your Terragen picture as usual and render it. The following parameters need to be written down on a paper. You will need them later in this tutorial.
- camera position x: 41
- camera position y: 130
- camera position z: 16.367
- camera orientation head: 97.977
- camera orientation pitch: 4.415
- camera orientation bank: 0
- image size width (in pixels): 640
- image size height (in pixels): 480
- sun heading: -60
- sun altitude:60.832
- water level (if needed)
IMPORTANT REMARKS:
- TER2BLEND WORKS ONLY WITH TERRAGEN TERRAIN UNITS!
- DON'T CHANGE THE ZOOM/MAGNIFICATION OF TERRAGEN'S CAMERA (1.414)
- DON'T WORK WITH TERRAINS BIGGER THAN 257 X 257.
|
- Save your rendered picture to a directory of you choice and give it a name (e.g. web.bmp). Terragen pictures are saved as bmp files.
O.K. that was it for Terragen.
4. THINGS TO BE DONE IN YOUR FAVORITE PAINT PROGRAM.
This is simple. Start your favorite paint program (PSP, PS, GIMP,...) and open the bmp file you saved of your rendered picture. Save it as a TGA file (web.tga). This conversion is necessary because Blender can't read bmp files.
5. THINGS FIRST TO BE DONE IN BLENDER.
Before we can go on with Forester we must find out the scale factor of our object when placed on the terrain.
- Open Blender and load the tree.blend file.
- Start the Terrain script and import the web.ter file.
Don't forget to assign the "Shadow Only" material to the imported terrain.
- Select the tree and switch the 3D window to orthonormal mode (NumPad 5) and to front view (NumPad 1) and scale your view so you get a view like this:
We choosed orthonormal view because we don't want any perspective deformations while determining the scale of the object.
- As you can see, the tree is much to big to be placed on the terrain. So we scale it down till we think the size of the tree is OK.
- Now select only one part of the tree e.g. the trunk and push the N button on your keyboard. The SizeX will give you the scale factor we are going to use in Forester e.g.: 0.12. For this exercise we'll take a scale factor of 0.09 .
- Save your Blender file for later and quit Blender.
6. THINGS TO BE DONE IN FORESTER.
- Now start Forester and load (Ctrl T) your Terragen terrain file (web.ter)
- Fill in the camera data from Terragen into the Camera window (ctrl C) of Forester.
- Fill in the water height in the World settings (ctrl W)
- Go to the Terrain window. Uncheck Quick display to have a better view over the terrain you imported. push the Re-draw button. Forrester will update the terrain overview.
- Go to the Objects List (ctrl J). click on the Add Object button.
- Choose as object Type : Trees-Pine Tree1.
Remark : it is not important which object you choose. Forester is only used to place objects on the terrain. Later in Blender an object will be assigned to the places calculated by Forester.
- Choose as distribution shape . For this excersise we choose : Ellipsoid.
But e.g. you can choose Line to simulate a row of telephone poles.
according to the excellent Forester on line manual:
Ellipsoid : Objects are randomly positioned within the Ellipsoid centre Coord#1, size Coord#2. If objects are not locked to terrain, object distribution will form a cloud in space.
- Set the number of Copies to 250.
REMARK: The Forester2Blend script is for the moment limited to 1000 0bjects per run (Blender Objectcounter from 000 to 999).
But you can indeed run the script for a second time with a edited objects.txt where the first 1000 entries are deleted and the blender objects to be copied are given another name.
- Set the location and the size of the distribution shape in the Terrain window.
Locate the shape in front of the camera and don't make it to big. Otherwise the objects will be placed outside the view of the camera. This is a waste of memory and rendertime later in Blender.
Click in the Left/Right Mouse click box the Object Coord#1/#2 option.
On the picture of your terrain you can now place the distribution shape.
Left click sets the Coord#1. Right click sets the Coord#2. Note: the precise use of Coord#1 and Coord#2 depends on the current objects distribution shape.
Two other useful distribution shapes:
box 1 : Objects are uniformly spaced within the box with opposite corners at Coord#1 and Coord#2. Object positioning can be randomised by using an X-Y-Z variance.
box 2 : Objects are randomly spaced within the box with opposite corners at Coord#1 and Coord#2.
- Since we are going to use trees in Blender the shapes must be locked to the terrain.
- Trees don't rotate much around the X and Y axis. Let us take maximum 2 degrees. Let the rotation around the Z axis free.
The Forester manual says:
Sets the rotation of each object dupe. Tick the Fix boxes to set all dupes to exactly the same rotation. If a rotation axis has an unticked Fix box, then the rotation will be varied randomly with an amplitude equal to the rotation value (unless this is set to zero, in which case this rotation will be 100% random)
- Set the he scale parameters to 0.09 determined earlier in Blender.
In a forest there are small and big trees. So we want some variation in the heights of our trees. Untick the scale parameters and set the scale variance to 20 under the Variance header.
The Forester manual says:
Sets the scale of each object dupe. Tick the fix boxes to set all dupes to exactly the same scale. If a scale axis has an unticked Fix box then it will be scaled to within +sc% and -sc% of the scale value, where sc is the Scale Variance value.
- Since we don't have water in our final picture the water settings are put to ignore . If you have a lake then you must select the radio button avoid water .
- We want most of the trees in the valley and non on the summits. You can check the heights of your terrain in the Terrain window. The boxes under the terrain view. The Z parameter gives the height. About 10 is the lowest value and about 50 is the heighest point of our terrain.
We don't want a lower limit. So H-a and H-b of the altitude distribution can be left to -1000.
From a height of 25 we want lesser trees and finaly from a height of 30 we don't want no more trees.
- Set the slope distribution. It uses the same principles as the altitude distribution. So for slopes with an inclination of 40 and more we want less trees and for slopes steeper than 50 we want no trees.
- push the plot on Terrain button in the objects list window. So that we can check In the Terrain window our distribution of objects. Each red dot represents an object.
- Once the distribution is OK push that Export Objects button in the Objects list Window.
Save the export file as objects.txt . This name is obliged !!
7. AND AGAIN BLENDER.
Forester made us an objects.txt file which contains the distribution of the objects over our terrain. Now we are going to assign a Blender object to these object locations.
- reopen your tree.blend file and select the Forester2Blend script
- Select the complete tree and move it to layer 2. This is done to keep an overview of what we are doing.
- Go to layer 2 and select one part of the tree, e.g. the trunk and move it to layer 3.
- Now it is time for the magic! Go to layer 3 and select the trunk. Move your mouse over the script window (check if Forester2Blend is selected) and push alt P The trunk will be copied a 250 times according the coordinates from objects.txt!
- VERY IMPORTANT: Select all the copies with border select ( B key) and select the original trunk as last. (so the original trunk is the active object)
Now push ctrl L . This gives us the Make Links menu. This menu is used to copy links between the active object and the selected objects. Chose the Materials option. All selected objects are now given links that are identical to the materials of the active object. This means that the entire material situation is copied.
- Select all objects on layer 3 and move them back to layer 2. Select layer 2.
- Select the next part of the tree and do the same starting from number start from number 3: copie the selected object to layer three... Do the same for all the other parts of the tree.
,...
- If you have done all the steps for all the objects you will have something like this on layer 2. Move now all your trees back to layer one.
- Switch to layer one and select your camera view. Here they are: 250 trees planted on your mesh!!
- This is the view you have when DrawMode is set to solid ( Z key)
- Don't start rendering! You still have to place your lamp in the right location! Select the spotlight and move it till it lights all the trees. Scale down the spotsize so that only the trees are lit and play with the clipstart and clipend so that the trees are caught between those two.
- OK! Now you can render!
Don't forget to put web.tga in backbuf.
Et voila, there you have an instant forest made with only One Tree!
Happy Blendering,
Guy (31 -july - 2001)
|