Advanced Image Synthesis

Mini Project SS06 : Realtime rendering of a fractal plant

By Jessy Kiriyanthan, Marcel Meili

Contents

Project description: Real Time Rendering of a fractal plant
(Original project proposal: 11.April 2006)

  • What do we want to do?
    Use procedural (i.e. computer generated) geometry.
  • What results do we want to show?
    As a result of computer generated geometry we want to simulate the growth of plants.
  • What are the technical problems we have to solve?
    Invent and implement growth algorithms.
  • Which steps are necessary to solve those problems?
    • browse through existing growth/fractal algorithms
    • analysing advantages/disadvantages
    • then implement: trial & error
  • What third-party software or libraries do we want to use?
    C++, OpenGL
  • What software parts do we implement ourselves?
    the growth algorithm and other ideas to follow..
top

Development and Results

Start: Having our eyes fixed on implementing a growth simulation, we pretty soon started browsing the World Wide Web for existing growth algorithms and tools or basically anything that could give us some inspiration and help us find a starting point for our project. Indeed after just a few clicks we were overwhelmed with a lot of material and honestly speaking there was way too much information available. As weeks went by we realised that we couldn’t spend more time browsing further and instead it was time we sorted out the ideas we had collected till then. At this point we decided to do something fresh of our own and concentrate on a single growing tree. Now if you are asking yourself why we wanted to come up with a “new” algorithm, well the answer is simple. First of all, we wanted to be creative and model our own strategy of a growing tree and also implement the things we learnt in our own special way. Secondly, the papers on algorithms and various scenarios were worthwhile reading and good to study the various ways other people approach in their field, however, the scope they handled was too big to implement into a mini project. (Papers, simulators, webpages etc. are mentioned under 'References').

Progress: It was our choice to work with OpenGL and C++. Therefore, we had to put hands on configuring a suitable programming environment. In this process we experienced a lot of problems with the correct GL libraries and settings in Eclipse on Windows.

To begin with, we first drew a static 2D tree which later on turned 3D. Getting to a stage where we had a 3D model we realised it looked very unnatural with just two primary colours, brown for the stem & branches and green for the leaves.

To bring it more to live we added texture mapping. Textures were blended together with the object material colour (brown/green) to obtain good results. We also generated mitmaps with a linear filter. However, our tree now looked like a perfectly grown fairytale tree that was too good to be true. It was basically a fully grown fractal tree. Every branch had ‘x’ number of nodes at the ‘y’th position of ‘z’ length. To change this we inserted random growth properties. Having implemented these properties we resulted to a fully grown tree. Varying some properties/parameters we were able to generate different sizes of trees.

Branches and Leaves are not all features of our tree. We also added blossoms and fruits.

Moreover, varying certain parameters also lead us to simulating other tree arts. From our deciduous tree we could simulate tall trees like the Coast Red Wood or shrubs like the Forsythia.

In other words, we used polymorphism/dynamic binding. We declared a pointer of type "tree". During runtime various different types of trees will be initiated and attached to this pointer. When the tree has to be drawn, the draw method of the tree will be called. However, due to dynamic binding the method corresponding to the type of the attached run-time object will be triggered and hence drawing a tree of different tree type.

To be able to have an optimal view of our trees, we integrated a trackball and viewer. When the tree is rotated, translated or the window is reshaped, the whole scene would be redrawn. Now as the tree consisted of many random numbers, in each manipulation of the view a new tree was drawn. This newly drawn tree differed from the previous one and we no more could simulate the growth. To prevent this, the tree was created only once and stored in a display list. Redrawing the tree now meant merely to call the precompiled display list.

Future thoughts:

- Simulate the growth of a tree initiated from a seed.
- Smooth transition between different levels of a tree.
- Considering different types of plants with varying structure, flowers etc.
- Considering environmental factors such as sunlight, water supply that affect growth.
- Integrating landscapes.

top

Used and implemented technologies:

  1. Real time growth controllers
  2. symmetrical and/or random growth
  3. variations of fractal and L-System principles
  4. texture mapping
  5. ambient and diffuse light
  6. choice of tree type (Deciduous tree / Coast RedWood / Forsythia / SalixAlba / an artificial Tree)
  7. object oriented code --> easily extendable
top

Source Code, Binaries [ 27. June 2006 ]

source code
executable treez (compiled on linux)

top

Software documentation

Software requirements:
- OpenGL - Glut:
debian: "apt-get install freeglut3"
windows: GLUT 3.7 libraries for Windows: http://graphics.ethz.ch/Downloads/Code/GLUT_37.zip
Copy the dynamic link library "glut32.dll" to the system folder where all dll-files reside. On Windows NT systems, the system folder is C:\WINNT\system32\. Here the other OpenGL dll-files (opengl32.dll, glu.dll..) are to be found. In case of self compiling, the libraries (*.lib) and header files (*.h) have to be copied to appropriate C++ programming environment folders. *.lib -> \lib; *.h -> \include\GL

Hardware requirements:
3D Hardware Accelerator Card
Memory: 512 MB RAM Recommended

User manual:

Download source files and compile the code or directly download the precompiled linux version. Start the executable (no initial parameter inputs required). During runtime press:

1 – to draw a Deciduous tree (default)
2 - to draw a Coast Redwood
3 - to draw a Forsythia Shrub
4 - to draw a Salix Alba
5 - to draw an artificial tree

Spacebar - to draw a new tree of the selected tree type
Esc – to quit program

x and y buttons are to simulate the growth.
X – tree “grows”
Y – tree “shrinks”

l - toggle leaves
b - toggle blossoms
a - toggle apples
f - fullscreen

Mouse controls:
Left button – trackball / rotate
Mid button – dolly / zoom
Right button - translate

top

Gallery:

Fine screenshots taken during the project progress :

Previous Next

and some mistakes:

mistake01 mistake02 mistake03 mistake04 mistake05 mistake06

some references

http://algorithmicbotany.org/
http://www.naturewizard.com/
http://coco.ccu.uniovi.es/malva/sketchbook/
http://graphics.stanford.edu/papers/ecosys/
http://www-sop.inria.fr/virtualplants/Publications/2005/FGP05/
http://algorithmicbotany.org/papers/mpg.copb2004.html
http://repositories.cdlib.org/postprints/962/
http://www.cs.mcgill.ca/~svasil/557/Report557.htm
http://artis.imag.fr/Publications/2001/SSBD01/
http://www.acm.org/crossroads/xrds8-2/plantsim.html
http://www.esuli.it/archives/2006/04/entry_12.html

last update: 1 July, 2006