TRealv0.1, © 2002-2003 Ton van den Heuvel

A program for creating realistic trees based on the tree model described by Jason Weber and Joseph Penn in [TREE]. Made for an assigment of the course Orientation (2M980), at the Eindhoven University of Technology.

Ton van den Heuvel, student-id: s474628, e-mail: A.W.v.d.Heuvel@Student.tue.nl


News


Contents


Program description

TReal is a program capable of generating realistic 3D tree models. TReal generates an internal 3D representation of a tree based on various parameters. The model used for generating the tree is described in [TREE]. Using plugins the internal representation of the tree can be exported to a scene file for a particular 3D program. I've currently written one plugin for TReal, called POVTReal. POVTReal is able to output standard POV-Ray scenes that can be rendered with the POV-Ray raytracer. More information about POV-Ray can be found here: http://www.povray.org. Since there currently exists only one plugin for TReal you will have to download POV-Ray if you want to generate images with TReal. A direct link to the windows version of POV-Ray can be found here:

http://www.povray.org/redirect/www.povray.org/ftp/pub/povray/Official/Windows/povwin35.exe.

TReal is written in Borland Delphi 6.0 on a Windows XP machine. It uses two home-built components, namely TFloatEdit and TNumberEdit for inputting floating point values and integer values respectively.

I successfully tested TReal on two systems, one running Windows 2000 and the other one running Windows XP, but it should be able to run properly on any 32-bit Windows platform. The system requirements for TReal are rather low. It runs properly on a Celeron 333MHz, with 128MB of RAM. However, POV-Ray needs a substantial amount of RAM to render an image of the tree. This is mainly due to the large POV-Ray input files POVTReal generates. For a tree with a high recursion level (four or up) and a substantial amount of leaves the POV-Ray input file could become as large as 40MB. I'm still researching methods to cut down the file size for future upgrades of POVTReal.

The source code of the home-made components can be found here in zipped format. The source code of these components is also available in the /source/components directory of the CD, in non-zipped format. The source code of POVTReal can be found here in zipped format. The source code of POVTReal is also available in the /source/povtreal directory of the CD. The source code of TReal can be found here in zipped format, or in the /source/treal directory of the CD. For a zipped executable (along with the POVTReal DLL and some sample tree definitions) click here. TReal has also been pre-installed in the /treal directory on this CD. A small overview of the different links:


Manual

A collection of low level tree parameters is called a 'Tree defintion file' (a .trd file). These files can be loaded and saved via the File menu (figure 1), or via the toolbar (figure 2). There is a seperation between high-level model parameters and low-level parameters. High-level parameters are parameters like the season, and low-level parameters are the model parameters as described in [TREE] (with a few extra parameters added). Tree definition files don't store high level parameters. High-level parameters are mapped on the low-level parameters when the user decides to render the tree.

Figure 1 - File menu

Figure 2 - Toolbar

At first, we'll have a look at the high level parameters (figure 3). Various high level parameters can be set:

Figure 3 - High level parameters

As an example a Black Tupelo is shown figure 4 up to figure 7 for every season.

 
Figure 4 - Winter   Figure 5 - Spring
 
Figure 6 - Summer   Figure 7 - Autumn

In figure 8 up to 11 the input fields for the various categories of low level parameters are depicted. Most of the low-level parameters directly correspond with the parameters as used in [TREE]. I refer to [TREE] here for the exact meaning of each parameter. Some of the parameters don't have any effect right now, because the elements of the model they correspond with have not been implemented yet. Also, I have added some extra parameters to the model. For example, it is possible to set the leaf color, and to determine the amount of vertices each section of a stem is made up of.

Figure 8 - General tree parameters

Figure 9 - Stem parameters

Figure 10 - Leaf parameters

Figure 11 - Pruning parameters

Each stem recursion level has its own set of parameters. Every time the recursion level is set in the 'General tree parameters' section, the amount of tabsheets in the 'Stem parameters' section is updated. Each tabsheet belongs to a particular stem recursion level (figure 9).

Generating the tree is done by clicking the 'Render' menu option, and subsequently selecting 'Select plugin...'. Subsequently a form will be displayed that shows the available plugins that can be used to export the internal tree representation to a general 3D format (figure 12).

Figure 12 - Plugin list

As I've said before, there currently exists only one plugin to export the internal tree representation to a 3D program, namely POVTReal. POVTReal creates a POV-Ray scene of the internally generated tree. Before the user can properly use POVTReal, he or she will first have to configure it. Configuring POVTReal is done by selecting POVTReal from the plugins list, and subsequenly clicking the 'Settings' button. The window as shown in figure 13 will pop up. The location of the POV-Ray executable has to be specified, as well as the name of the POV-Ray input file and the name of the image file POV-Ray should create. Furthermore, the user can specify to display coordinate axes along with the tree, or to normalize the tree dimensions of the tree (the last option isn't implemented yet). After configuring POVTReal, clicking the Render button will start POV-Ray and render the tree.

Figure 13 - POVTReal settings


Design decisions

Mathematical model

The first choice that had to be made was which model to use to generate the tree. I decided the tree had to be as realistic as possible. After a lot of research on the web I found a model that is capable of creating very realistic trees. It is described in "The Creation and Rendering of Realistic Trees" by Jason Weber and Joseph Penn [TREE]. Although the model uses quite a lot of parameters, I decided to use their model because of the (potential) good results that could be obtained with it. Another big advantage of the model is that it is able to produce both dichotomous and monopedial trees. I decided to make a seperation between the model parameters, the so-called low-level parameters, and the more general parameters like the season, the so-called high-level parameters. Some elements of the model have not been implemented yet:

These elements of the model will be implemented in future versions of TReal.

Implementation

Another decision was how I would implement the funtionality of the program. I could go for a realtime OpenGL visualization of the tree. In practice this wasn't really an option because of the huge amounts of triangles a tree can consist of when the previously mentioned model is used. It would require a very heavy computer to visualize the tree in realtime OpenGL. I decided I would create an interface for the user to input the parameters of the model, and to let the user choose to what format the 3D tree should be exported. This has been made possible by making TReal completely pluginable. TReal internally generates a mesh representation of the tree, which the selected plugin uses to create a 3D representation in the format of the 3D program the plugin was written for. Currently, only one plugin exists (for the raytracer POV-Ray) but it is fairly easy to create additional plugins for 3D Studio Max or other mainstream 3D programs.

Programming language

The next decision I had to make was the programming language I would use. I choose for Borland Delphi 6.0, since I had quite a lot of experience with this language. Currently, there exists only a 32-bit Windows version of TReal, but it should be possible in theory to use Borland Kylix to port TReal to other platforms. Furthermore, with the IDE of Borland Delphi it is possible to create a nice user interface in a reasonable short time.


Technical details

When the user chooses to render the tree, at first an internal representation of the tree is created. A tree is a TTree object, consisting of a Trunk of the type TStem. Every stem has a list of substems. The tree is recursively generated by first growing the trunk, then all the children of the trunk and so on. The last level in the recursion are the leaves.

The stems consist of a list of sections; in fact 'circles' (when lobing is used these circles are deformed) defined by a number of vertices. More vertices per section of a stem at recursion level n positively influences the quality of stems at recursion level n. The number of vertices can be specified by the user (this is in fact an extra parameter I've added to the model). Every stem and every section making up a stem have a local coordinate system associated with it. When writing the section vertices to the internal representation of the tree, these local coordinates are converted to global coordinates. Please note that all the classes implementing the scaling, rotating, matrices operations, and coordinate conversions have been written by me.

The tree definition is stored as a list of values in a text file. Currently, the structure of a tree definition file is very strict, and editing of the tree definition file using a text editor is almost impossible, because none of the values has a description associated with it.

All the internal settings of TReal and POVTReal are stored in the registry, HKEY_CURRENT_USER\Software\Green Hill Software\TReal and HKEY_CURRENT_USER\Software\Green Hill Software\POVTReal respectively.


Gallery

The following section contains some pictures produced by POV-Ray to illustrate what TReal and POVTReal are capable of. On my PC (1400MHz, 256MB RAM) the quaking aspen took 3 minutes and 11 seconds to render (being the fastest) and the Tamarack took almost 14 (!) minutes to render (being the slowest).

 
Figure 14 - Eastern Cottonwood   Figure 15 - Lombardy Poplar
 
 
Figure 16 - Quaking Aspen   Figure 17 - Quaking Aspen in the autumn
 
 
Figure 17 - Sassafras   Figure 18 - A dead Sassafras
 
 
Figure 19 - Tamarack   Figure 20 - Black Tupelo in the autumn


What's next?

There are still some features on my wish list. The following features will probably be implemented in future versions of TReal and POVTReal:


References
[TREE] Creation and Rendering of Realistic Trees
Jason Weber, Joseph Penn
ACM Press New York, NY, USA
1995
Pages: 119 - 128 Series-Proceeding-Article
ISBN:0-89791-701-4

http://portal.acm.org/citation.cfm?id=218427