Adding Detail to a Region – Forests – Example 20.6
We may want to add some more detail to particular regions, such as the forests, instead of simply extruding a mass. Here, desire for detail or realism has to be balanced with overall performance of both grasshopper and Rhino itself. One particular aspect I’ve played around with a bit that creates a lot of modeling challenges is trees and forests. An individual tree is an incredibly complex structure, let alone a forest. Hopefully I’ll be able to show better results in the future, but here is where I am at the moment. For “rendering” quality models, it is still probably better just to show the general outlines of trees and forests and then do post-production in photoshop. This can be time consuming, though, so the more we can do automatically the better.
Initial Steps – Setting Tree Locations in 2D
I will start this example assuming you have already identified and allocated your forest areas using the procedure described in Example 20.5. The first thing we want to do is to use the “Populate Geometry” component to randomly allocate our tree trunk locations. Note, however, that it might be best to populate the 2D geometry after “Region Intersection” and not the 3D geometry created from “Split Surface.” I tried populating the 3D geometry at first but always crashed my computer. Maybe I was doing something incorrectly, but even trying to populate this with 1 point caused the program to fail.
First we attach a “Boundary Surface” component to our 2D Forest Regions after “Region Intersection,” as shown above in Step 1. This will give us a surface to populate. We hook this into “Pop Geo”. With the default points as shown in Step 2, you’ll notice the larger areas have a lower density of points while the smaller areas are packed. This is because the population is based on the default 100. To have all the regions with a similar density of trees, we need to do a formula. We use the “Area” component on the 2D regions and divide the result by the average area each tree will consume. You should start large (1 tree per every 1000 m2, for example) and if everything is working fine, work your way down. I informally measured the density of trees while hiking one day in a fairly mature, uncluttered beech and pine forest near Hannover on the Deister mountain and found it was roughly 300m2 per tree. So let’s go with that. You should now get results similar to Step 3. If you want to stay in 2D, you could add circles with semi-random radii, and color them (here with fall colors! It is Sept 23 after all!) Step 4.
Creating a Simple 3D Forest
For now, though, we can disregard the last steps in the script above since our goal is to do a 3D model. At first, though, we want to stay simple so we will try and create just a simple 3D model of our forest.
The image directly above shows 3 simple steps to get started with a 3D forest. The 2D points are projected up to the 3D Surface (It is best to use the overall 3D surface, not the individual “Split-Surface” fragments). Then you could just draw a simple line for each tree trunk, with the height determined by a Random Number Generator using a Domain corresponding to the desired range of tree heights. If you want, you can put the circles I drew at the end of the 2D forest script onto the tops of the trees.
Note, the model of this landscape is not too large so if you want a denser forest, you can reduce the area per tree input into the PopGeo formula in the previous steps. If your Grasshopper is too taxed by this, though, an alternative is to draw one set of trees, bake the lines, and then change the random seed for a second set of lines, bake these, etc… until a desired density of trees is achieved. So if we wanted 1 tree for every 100m2, we could simply run the script below 3 times at 300m2 with three different random seeds.
Creating a Forest with Basic Branching
I think the single line forest looks pretty good, especially for a fir or spruce forest in an alpine scene, and also is the best way to sketch out a forest you will later overlay with trees in photoshop. You may want to show more complex trees in your model, though, so making some simple branching could be desirable.
The image above shows four steps for setting up a branch. First we determine a point for the branching. To do this I reparametricize my tree lines and then run “Evaluate Curve” to identify the point of branching. I then use the “Vector 2Pt” component to find the vector between this point and the tree top (straight up). I then rotate these vectors using a desired branching angle, and then randomly rotate them around. If this is confusing, you may want to look at some of the Vector script Examples.
So running that gets us 1 branch, using the vector with the SDL component to draw the branch. We can run a similar process to get more branches.
In the example script below, I can change the variable for number of branching, as well as the height for the 1st and last branches. I need to perfect the script to get better branch rotation, but this depends in part on the tree species and so I want to look at a few different species in more detail to get something a little nicer looking in the future. But it is OK for now.
Another thing I’d like to look at in the future is to put the height of the first branching higher up the tree the deeper in the forest the tree is. I think this should be pretty easy to do, but trees in exposed locations have lower and more branches, and are overall shorter, than trees in forests. I will post some results of experiments with this in due course.
I should mention that a similar process could be used for individual trees. These are sometimes drawn in OSM with the key “natural=tree” Here I added the points from “natural=tree” to the points generated after “PopGeo” and now have an overall tree massing for my town of Ecoteaux.
Depending on what you think looks good, you could combine the tree branching with the logic of the circles from the first step. Here I added some spheres with some transparency and overlaid them with the branches.