Rendering Realistic Trees and Forests in Real Time

Alberto Candussi, Nicola Candussi, and Tobias Höllerer


Realistic rendering of trees is not easy to achieve, especially in real time. The geometry complexity is intrinsically high. Trees can have hundreds of branches, and even more, thousands and thousands of leaves. The standard technique using triangle lists can't work. Even if only two triangles were used to represent each leaf, the number of triangles to be rendered would be in the order of 20,000-30,000, and only for one tree! It wouldn't be possible to have real-time performance for a small amount of trees, much less for a forest made of hundreds of plants. The goal of this project is to find some kind of alternative rendering technique to achieve an acceptable performance for rendering a forest full of trees. The trees should also realistically swing in the wind.


Rendering algorithm

Since most of the geometric complexity can be attributed to leaves, grouping them together into single billboards greatly reduces the polygon count while maintaining the volumetric appearance. We use grid meshes to approximate groups of smaller branches. A discrete set of LODs is used for roots, trunk, major and minor branches, and leaves. For cylindrical meshes like trunks and branches the complexity is reduced by decreasing the radial and longitudinal subdivision. Some elements that are less visible (for example, because hidden by leaves) are completely removed in lower LODs. The detail of the grid meshes used for minor branches is reduced by reducing the grid subdivision. In the case of billboards, lower detail levels have fewer and bigger billboards. This way, even if the geometric complexity is reduced, the difference between LODs becomes less apparent. To avoid the popping effect while going from one LOD to the other, we implemented a smooth fade-in/fade-out transition for billboards. The fade effect is done with alpha test; when fading out, the number of rendered pixels is smoothly reduced, when fading in, it is smoothly increased. This is done by assigning random alpha values for the billboard texture pixels and then varying the alpha comparison value for the alpha test. When the number of objects to be rendered becomes large, instancing and state ordering is essential. To decrease the number of texture swaps, a texture dictionary technique is used for grid meshes and billboards.


When a tree is being built all the animation properties (such as branch flexibility) are pre-computed. At run-time the tip of every branch is displaced and the rest of the branch movement is done by interpolating this transformation based on each vertex's distance to the tip. The displacement is computed as the sum of two vectors, one along the wind direction and the other one orthogonal to it. The first vector in general has a greater magnitude than the second, which gives the appearance that the tree is swaying along the wind direction. The second vector is used to add some noise to the movement. At each frame, periodically changing factors are added to these vectors, in order to modify their magnitude and direction. Leaves are animated depending on wind strength and direction; billboards perform an oscillation around the viewing axis, based on sine waves.

Here are links to some higher-res images  

Realistic Lighting and Shadows

Trunk and major branches are rendered using bump mapping and shadow mapping while minor branches use per vertex lighting and shadow mapping. Leaves lighting is obtained as a sum of four factors: per vertex lighting based on the sun's position, density factor, shadow map factor, occlusion factor. Per vertex lighting is computed assuming the vertex normals of the leaves are oriented along the radius of a sphere centered with the tree's bounding box. This way, leaves on the side of the tree that is closer to the light are brighter than leaves on the opposite side. A density factor takes into account the number of leaves surrounding the current leaf and is pre-computed. A shadow map factor is the result of the shadow map test on the current leaf. An occlusion factor determines the intensity of the projected shadow based on the depth value of the occluder saved on the shadow map. In the generation of the shadow map, billboards are rendered facing the light. Even if not physically correct, the resulting shadows appear realistic, because the sheer number of real leaves in a tree and the variance in leaf orientation makes it impossible for a human to anticipate the correct shadow perspective.

Please download the demo video here (28MB). It is compressed using divx 5.1.1 available from


Class project that this research started from: