Tuesday, May 3, 2011

Mango, Sequoia, Baobab

At some point I was wondering if Space Colonization was all I needed for creating trees. Since the method was so simple, I always had my doubts. Could it be used to produce trees beyond the classic examples you see in the method's description?

I set out to define different tree classes, all using the same algorithm, just different parameters. Here are the results (click on the image to get a higher resolution):


In this post I will introduce the main parameters I used. As you will see, most of them control how the initial points for the colonization are seeded in space, the rest is colonization magic.

First there is the crown's envelope. The envelope starts from an ellipsoid. The class defines vertical and horizontal radii for the ellipsoid. In the next image you can see this large ellipsoid noted as (a):


A portion of this ellipsoid may be empty. This is noted as (c). This section may be quite large for some classes  like the baobab. The class also determines a proportion between the height of the trunk (b) and the size of the ellipsoid (a).

As points are randomly created inside the crown volume, the odds for a point to be added depend on another parameter: the "crown density". This parameter goes from zero to one. If it is close to zero, most points end up in the surface of the ellipsoid. If it is close to one, they are distributed evenly inside the ellipsoid.

The following image illustrates this effect:


Not all trees have this kind of elliptical crown. Many appear to have a number of smaller crowns, often showing some gaps in-between.

I wanted to have a simple definition for the class so I immediately ruled out any verbose approach. I realized that if I inserted the colonization tree points in an R-Tree and the clump the points on each node, it would naturally compact some areas of the crown. The clumps could also be shifted vertically to mimic the stratification you see in some trees.

I added two main parameters to control the clumping of the crown. One for the radius of the clumps, the second for how strongly the points will be pulled towards each other within the same clump. Then I added a third parameter: a probability that an entire clump may be removed. When an entire clump goes away it creates a natural gap in the crown.

The baobab class uses this to achieve the distinct look of its crown. The clumps appear as ellipsoids, noted as (d):


You probably remember Leonardo's observation about tree branching. For two branches splitting from one main branch, it stated that the cross-section areas of the two branches would add up to the area of the main branch. Something like:


Where a, b and c are the branch diameters as noted in the image.

Well, maybe Leo never went to Africa. The pipe model holds for trees that only care about moving stuff up and down. In some dryer places, trees also store water. This makes the trunks and some of the branches fatter. To account for this I added another parameter that controls the exponent of this equation. By default it is 2 which applies to most trees, but it opens many interesting possibilities as the fat baobad model above shows.

And that's it. There are some other parameters controlling the roots and venation, but they are quite similar to the ones I described above. One interesting addition to the algorithm is that now it produces very visible large veins along the trunk and main branches. I will cover this in a future post.

If you can think of a tree that cannot be represented by these parameters, just drop a comment here and point to the tree. I will try to reproduce it.




13 comments:

  1. Well there's still the matter of pine trees isn't there? From what I see your trees build branches upwards whereas a pine tree's branches form downwards. Got any nifty plans for that one?

    ReplyDelete
  2. Correct, no matter how much I tweak these parameters, I cannot do a pine tree with this. Growing downwards is not difficult. The colonization cannot really tell up from down, it is matter of how the space is seeded. I will be doing pine trees on the next iteration.

    Something else I cannot do: palm trees. For those I don't have a clue. Still sleeping on that one.

    ReplyDelete
  3. Perhaps something along the lines of a flat elipsoid for the crown and then just branch out in single lines for the palm trees? Generating leaves at intervals along the branches.

    ReplyDelete
  4. What about willows?

    ReplyDelete
  5. To me it feels palm trees are not really trees. They are overgrown plants :) At this point I'm not sure if I'm covering other plants. For that I will probably need an L-System.

    Took note on the Willow. Thanks.

    ReplyDelete
  6. I'd be interested to see the system do
    Acacia:
    http://www.seedman.com/image/2189.jpg
    (I suppose a would be very small in comparison to b, and c quite large in comparison to a.)
    Live Oak:
    http://blogs.olin.edu/studentblog/2008/07/live-oak.jpg
    http://www.dnr.sc.gov/marine/mrri/acechar/specgal/image/photos/liveoak2.jpg
    (Action of gravity on thick air-branches.)
    and Banyan trees:
    http://veniceareahomesblog.com/image_store/uploads/1/5/4/9/4/ar124085550349451.JPG
    (drop secondary roots from air-branches.)

    Fascinating project.

    ReplyDelete
  7. @DmL: Thanks for the suggestions. Acacia trees were my inspiration for the third line of trees in the first image, but I did not push it close enough. I think with some tweaks to those parameters they can be obtained.

    I don't have the effect of gravity on branches. It is a very good suggestion.

    Regarding the Banyan tree, I would need to allow roots to come from other points in the tree rather than just the base. It would require some changes to the algorithm and new parameters. They are beautiful trees, I will keep them in mind for the next iteration.

    ReplyDelete
  8. Can you tell I am from warm and wet climes? : )

    ReplyDelete
  9. You need a parameter for having all the veins twist, to do trees like this: http://images.wikia.com/jamescameronsavatar/images/c/c3/Pandora8.jpg
    I highly recommend watching the plant-scenes of Avatar for some inspiration about good looking (if not entirely realistic) jungles.

    Some trees have roots which are not round, but start way above ground ( http://images.travelpod.com/users/brianpbrady/1.1277061529.brian-in-a-crazy-tree.jpg ), and it looks like this could be approximated by adding a parameter for stretching roots vertically as they are closer to the trunk (with elipical cross-sections), and not stretching them as they get farther from the trunk.

    Strangler figs have strange body shapes ( http://impressive.net/people/gerald/2007/03/15/08-27-33-med.jpg ), with only secondary roots, since it takes seed in the crotch of other tree's branches, then starts dropping roots, gradually taking over the whole area, by spreading across the canopy, and building s mesh of roots around the trunk of the hosts, which eventually rot out and die. ( http://imgc.allpostersimages.com/images/P-473-488-90/38/3815/FDBYF00Z/posters/Henry-LehnStrangler-Fig-Ficus-Growing-on-its-Host-Tree-in-a-Tropical-Rainforest-Costa-Rica-.jpg )

    Roots for trees growing in rocky places need to slink over one another, seeking out depressions and crevices ( http://farm2.static.flickr.com/1248/548572381_c349f975af.jpg and http://static.photo.net/attachments/bboard/00P/00PPR1-43347684.jpg ).

    For other plants, grasses, ferns and mosses should be relatively easy to do, since moss like moist, shady rocks, ferns like moist, shady soil, and grasses grow everywhere else (it grows taller with more sunlight, and greener with more moisture). Ferns seem to cap out at around 4-5m across ( http://www.terminalia.org/tour/nz7big.jpg ) in really moist areas (remember that trees actually increase the moisture in an area by trapping it under their canopy), and as small as can be rendered in similar spots, with mid-sized ferns occupying areas the others can't survive in.

    This world looks really great.

    ReplyDelete
  10. @Jason: Thanks for the post, very comprehensive.

    ReplyDelete
  11. Hello!

    Wired did an article recently on how the actual relationship is between 1.8 to 2.3 for almost all known tree species (and why it is wind that is the driving limitation). They link over to ScienceNow which probably links over to someplace with more detail.

    Wired article URL:

    http://www.wired.com/wiredscience/2011/11/branching-tree-physics/

    ReplyDelete
  12. A very interesting post, in case it's of interest, I've posted about my own somewhat different experiments with procedural tree generation on my procedural universe project blog:

    http://johnwhigham.blogspot.com/2011/12/seeing-wood-for-trees.html

    ReplyDelete
  13. i feel this algorithm gives half the story - overall form is there,but feels chaotic, branches lack detail - waviness,splitting,some geometric orderliness,elegance.while Arbaro makes it too geometric,repetitive.

    ReplyDelete