Creating a Tree
 
 
 

Overview

This tutorial describes the use of "for" loops and nested transformations to create a fir tree. The model developed here uses differential equations to simulate the growth of branches. This allows the animation of a tree growing from sapling to adult.

Branching and Looping

A tree may be described as a trunk with branches. On each branch are other branches, and so on.

The loop for each branch is as follows:

{

Create a branch

loop for each sub-branch

{

create a sub-branch

loop for each pine needle

{

create a sub-sub-branch

}

}

}

Almost any tree model will have such a structure. The trick is to know how to position the sub-branches on each branch and how many to create. The positioning is comparatively simple if the branching structure is also used to control the transformation hierarchy: then the branches only need to be rotated about their origin and then translated along the branch.

Dynamic Model of Simple Tree Growth

Along a particular limb the growth rate is zero below a certain time and jumps to max at a time proportional to the index position along the branch. The growth rate decays to zero exponentially thereafter.

For position i

where M is the maximum length for the segment,

t is the time,

k is the growth initiation rate, and

d is the growth rate.

The position of the segment a is L(a) which is given by

Given an index value

Where m defines the maximum rate of change of position with respect to the branch number,

d defines the time interval over which growth rate decays to zero, and

k defines the rate at which the new growth initiator moves with respect to position index.

Rendering Tips

The tree generated by this file looks very convincing with a stretched fractal bump map for bark. Unfortunately, the fine pointed elements of the branches lead to sampling problems unless the "aathreshold" is set to zero. This, in turn, leads to increased rendering times.

The needle density was increased until the computer ran out of paging disk. Fir trees are pathologically complicated. Try using fewer branches and no needles. Try placing fruit on the branches, or create candles for a Christmas tree. Try adapting the model for curved branches, such as on an apple tree.