CmpE 460 - Term Project
VIRTUAL FOREST PLANT AND SCENE DESIGNS PROJECT DESCRIPTION & MANUAL
Işık Barış Fidaner 2001102110
Başar Uğur 2001100940
INTRODUCTION In this project, we had the purpose of creating a design product which had a robust engineering part with an impressive art dimension. And this idea also involved the ability to be used in creating scenes for motion pictures or game demonstrations. What we have come up with, if compared to what we aimed at the beginning, is different, but not too much. This document is the result of a struggle of explaining all the aspects of what we have done so far. GENERAL STRUCTURE To be added to the specification document we had before, we can start with explaining our layer structure depending on the existing classes. The layers are classified like this: -
Primitives : These are display lists which correspond to a collection of polygons, which form convex 3d polyhedra, defined by the exact locations in 3d space using directly OpenGL with functions like glVertex3f. Ex:
-
A wooden branch of Maple is itself a primitive.
Plant parts : These are either primitives with textures bound, or collection of primitives which are arranged in suitable 3d locations with different textures and colors bound. Ex:
A fruit of Bush is a collection of primitives.
-
Modeller : Modeller is a tool for modelling a new plant of specified type or just modelling a scene of defined plant types. It encloses all the restrictions for each plant.
-
Plant types : A plant type is a collection of specific plant parts joined by a number of rules. These rules are different for each plant type which will be explained later. 1. MAPLE TREE. It consists of wooden and green branches, red maple leaves and strange orange-like fruits. The restrictions are: A wooden branch can add a wooden branch, a green branch, a maple leaf or a fruit to its end. A green branch can add a green branch, a maple leaf or a fruit to its end. A maple leaf or a fruit can’t add anything to their ends. Ex:
An example of maple tree.
2. BUSH. It consists of its own type branches, leaves, fruits and additionally, flowers. The restrictions are: A branch can add another branch, a leaf, a fruit or a flower to its end.
Ex:
A leaf, a fruit or a flower can’t add anything to their ends. An example of bush.
3. ALIEN TREE. It consists of its own type branches, leaves, fruits and flowers. The restrictions are: A branch can add another branch, a leaf, a fruit or a flower to its end. A leaf, a fruit or a flower can’t add anything to their ends. Ex: An example of alien tree.
- Animator : This is the layer where all the animations about moving around the scene are implemented. There is a system clock ticking on the background and the system responses the keyboard input by changing the different values for camera acceleration and therefore affecting the velocity. Ending of a motion (stopping) is done by decreasing the velocity, hence giving out a smooth stopping animation for the sake of user experience. - Viewer: This is the layer where everything is put on screen. This layer is handled again by OpenGL functions but, not to be referred as the lower levels of the layered structure, they are higher level settings like lighting adjustment, double buffering, etc.
FILE STRUCTURE There are two types of files used in the system: 1. Plant Description 2. Scene Description Plant description describes a plant exactly at its originated position and is used to load a plant to the modeller easily. Scene description makes use of the plant descriptions and keeps the necessary properties of the used plants. For the exact descriptions of these files, please refer to Figure 1 & 2. <name of the plant> <type of the plant>
-- any string -- 1 / 2 / 3
<number of plant parts> -- that’ll be read from the file { for all plant parts from the leaves to the root, repeat this: } <id of plant part> <type of plant part> -- integers <rotation x> <rotation y> <rotation z> -- floating points <scaling x> <scaling y> <scaling z> -- floating points <general scaling> -- floating point <number of children> <id of child 1> <id of child 2> … -- integers { end }
Figure 1. Plant Description File The plant description files are at this structure with the ordering “leaves to root”. Because it is easier to form the plant (which is a “tree” from the point of view of computer science) by firstly defining the “children”, then adding the “parent”s whose children exist already in the system. Writing is, therefore, done by a depth-first-search manner, for the sake of fast reading. <number of plant descriptions used> <plant description 1’s file name> <plant description 2’s file name> <plant description 3’s file name> ... <number of plants in the scene> { for all plants in the scene: } <position x> <position y> <position <rotation x> <rotation y> <rotation <general scaling> { end }
-----
integer string string string
z> -- floating points z> -- floating points -- floating point
Figure 2. Scene Description File The ordering in a scene description file is of course, not important. The files are simple and easily read and loaded to the system.
USER MANUAL There is a simple user manual that can be read while the program is loading its textures from the command prompt screen. Here is an extended and explanatory version of it: Plant Modelling Screen. The program starts at the Modelling scene of the 1st type of plant with just one plant part; the plant’s stem. From there, by clicking on the MAIN options you can: - Create a new plant of type 1, 2 or 3. - Load an existing plant to the modelling module. - Save the model you just created. - Or, quit (would you?). As a shortcoming of OpenGL, keyboard typing interaction is a little hard, therefore please try not to make any typing mistakes because at the current version, you can’t remove your mistypings. Additionally, when you click (once) on a plant part, it is bound with a cold light blue texture which indicates that it is selected, and by the help of the PLANT PART options menu you can: - Add a new part to its end IF it is possible. - Remove this part (i.e. including all its descendants). - Modify this part by: o Rotating with clicking the LEFT mouse button and moving the mouse accordingly. o Scaling with clicking the RIGHT mouse button and moving it LEFT-RIGHT for WIDTH and UP-DOWN for LENGTH. You can end modification by clicking ond the “End Modification” tab on the top left or simply double-clicking on an empty area of the screen. You can also de-select the plant part you’ve selected by clicking on an empty area again. Scene Modelling Screen. You can switch between Plant and Scene Modelling Screens by pressing F1, but DO NOT forget to SAVE your work before you decide to switch at each screen, because you lose your data if you don’t save. Additionally, you can switch between environmental settings in the Scene Modelling Screen by pressing F2, and that time you don’t have the risk to lose your plants’ position in the scene. -
Here is the usage of the MAIN options: NEW: Clears the environment (forgetting the previous) to form a new scene. ADD: Adds a previously saved .PD (plant description) file. The plants are all added to the same position (0,0,0). Hence don’t be surprised if you can’t see the plant immediately after you add it, maybe it is at your back so that you can’t see it! LOAD: Loads a previously saved .SD (scene description) file. SAVE: Saves the current scene description to the specified file. QUIT: Quits. (please don’t.)
The SCENE options are so many that a list would again be much more useful. Let us first tell that you can choose a plant in the scene by just clicking on it. But however, the
only indication that you have selected a plant is the PLANT MODIFICATION menu that appears on the top left. Please mind this if you try to modify a plant in the scene. - W: Move the camera forward. - S: Move the camera backward. - A: Strafe left. (i.e. walk perpendicular to your forward vector) - D: Strafe right. (same idea) - Q or LeftMouseButton+MoveMouseLeft: Turn the camera to the left. - E or LeftMouseButton+MoveMouseRight: Turn the camera to the right. - R or LeftMouseButton+MoveMouseForward: Turn the camera to upwards. - F or LeftMouseButton+MoveMouseBackward: Turn the camera to downwards. - T or RightMouseButton+MoveMouseForward: Move the camera up. (along the Y axis) - G or RightMouseButton+MoveMouseBackward: Move the camera down. (same) (After clicking on a plant) - Remove Plant: Remov e the plant from the scene. - Place Plant: o LeftMouseButton+MoveMouseForward: Move the plant in -z direction. o LeftMouseButton+MoveMouseBackward: Move the plant in +z direction. o LeftMouseButton+MoveMouseLeft: Move the plant in -x direction. o LeftMouseButton+MoveMouseRight: Move the plant in +x direction. o RightMouseButton+MoveMouseForward: Move the plant in +y direction. o RightMouseButton+MoveMouseBackward: Move the plant in -y direction. -
Rotate / Scale plant: (the root is at a fixed point, where it is.) o LeftMouseButton+MoveMouseForward: Rotate the plant counterclockwise around the x-axis. o LeftMouseButton+MoveMouseBackward: Rotate the plant clockwise around the x-axis. o LeftMouseButton+MoveMouseLeft: Rotate the plant counterclockwise around the z-axis. o LeftMouseButton+MoveMouseRight: Rotate the plant clockwise around the z-axis. o RightMouseButton+MoveMouseLeft: Rotate the plant clockwise around the y-axis. o RightMouseButton+MoveMouseRight: Rotate the plant to counterclockwise around the y-axis. o RightMouseButton+MoveMouseForward: Increase the plant’s scaling (enlarge). o RightMouseButton+MoveMouseBackward: Decrease the plant’s scaling (shrink).
All these instructions are better be practiced than read. It is also the way the user can learn and get used to them better. Başar Uğur & Işık Barış Fidaner – June 2004