Why Trees?
As both an artist and a computer scientist, I've always loved the fractal-like patterns of plants. I often find myself wondering how to best break them down into shapes, colors, and algorithms.
So for my final project, I decided to define trees in a way that was simple enough to model and render in real time, but complex enough to maintain a sense of realism.
Research
I began this project by studying L-systems: sets of rules for generating recursive, fractal-like shapes. However, I quickly found that this system didn't quite suit my needs. Given similar starting values, an L-system would generate nearly identical trees, and switching realistically between rules for branches, stems, and leaves proved difficult. Instead, I took what I had learned and branched off on my own route.
Most of my research came from looking at real plants and reasoning about their sizes and shapes. Through a lot of measurement and a little trial and error, I found that the angle-to-length ratio of a leaf can be approximated using a limacon with the diameter of the golden ratio. I also found that the sizes of tree limbs scale logarithmically, and that branches will almost never grow downward except by gravity or force.
The resulting framework uses a series of rules and probability with a touch of randomness. Most rules (such as model and branch frequency) are defined as part of a struct, and others (such as complexity) can be changed on the fly using the arrow keys.