Simulating Crown Shyness in Tree Canopies
Lorem Ipsum
What is Crown Shyness?
Examples
Photo by Tom Cowey used with permission.
Another great example is this video of a rātā forest on Instagram by Michael George.
A Teleonomic Process
Seeing Structure
Our brains have evolved to find patterns, and ascribe rules and principles to the things we observe. Once a pattern is recognized, it can be modeled.
Expressing a Pattern
I’d wanted to use code to abstractly model crown shyness for years—particularly the shapes and gaps that arise organically.
The pattern (or set of procedural rules) that made sense to me was a series of groupings and clustering of points at different scales—analogous to the branching structure of the tree itself: one large trunk, a handful of limbs, several smaller branches, etc.
Starting with a uniformly distributed field of leaves, one can create local divisions and groupings at different scales, shift the leaves in each group slightly towards the group’s center, and produce something that looks passably like a tree canopy.
The Algorithms
This called for two of my favorite algorithms to use in generative art: Poisson disc sampling, and Voronoi plane paritions.
Poisson Disc Sampling
This will be how we seed our leaves and define the centroids for each layer of grouping for the trees and branches.
Mike Bostock has a great visual explanation of exactly how Bridson’s algorithm for Poisson disc sampling (the one used here) works in his article Visualizing Algorithms.
Voronoi Partitions
Voronoi partitions divide a plane into regions of points closest to a given set of points. You start with a set of points, and then draw a shape around all the points closest to a particular point.
For another way to think of it, start with a set of predefined points. Imagine a ripple expands from each point, starting at the same time and moving at the same speed. All of the places that ripple gets to first are within that point’s Voronoi region. And all the places that ripples meet form the edges of those regions:
These shapes help visualize which group at each level each leaf falls into, based on proximity.
Building the Model
The model can begin to take shape when we combine the concepts of Poisson distributions and Voronoi partitions.
Step 1
First, start with a uniformly dense field of random points for our “leaves”.
Step 2
Next create a more sparse set of random points for the center of our “branch” groupings and measure which leaves are closest to which branch.
Step 3
Then shift each leaf slightly closer to the nearest branch forming branch clusters of leaves.
Step 4
Create a new set of sparser points for the “tree” groupings and measure which leaves are closest to which tree.
Step 5
Shift each leaf slightly again—this time towards the nearest tree.