User Tools

Site Tools


gamedev:treecanopylod

This is an old revision of the document!


LODing in the Drag[en]gine allows for some special LODing tricks. This page explains one of them. Trees in games are always a problem. These natural structures are very complex and diverse. To model a proper tree with dense foilage you need a lot of triangles. Tricks exist to wrap twigs or entire branches with textures. While these do help at close up it is hard to make them convincing. This requires usually higher polygon count which in turn hits performance a lot on distance and with a lot of trees. Another solution are billboards at the distance. These have though their own set of restrictions and problems. The Tree Canopy LOD technique takes a stab at geometrical LODing of trees with dense foilage. The billboard trick can still be used together.

Tree at LOD-0

Tree at LOD-0. This close the canopy requires a lot of geometrical detail to look convincing. This tree here has 17'576 triangles.

LODing the trunk and branches where made out of actual geometry is the easy part of the problem. The main problem are the foliage. To get a reduction worth saving performance the number of triangles in the foliage has to be dropped to 25-50% of the base count. Removing this many triangles is not going to look good because the density of the canopy changes a lot making it glaringly obvious upon switching LOD meshes. To counter this in the game a trick is used. Instead of just removing triangles like mad a special Canopy LOD meshes are added in the LOD meshes. The idea is to compensate the loss in foliage density due to removing lots of smaller branches with some low polygon meshes in the canopy faking dense foliage at the distance. For this a new texture is used containing a seamless representation of branches running nilly willy across the texture. This is a masked transparent texture used only by the LOD meshes. Hence it is present also in the base mesh but not used there. 3 to 4 such low polygon meshes are created stacked inside each other and hidden in the canopy. The meshes are created to capture to some extend the shape of vertices inside the canopy. At the outside a layer of real geometry foliage is left untouched as we only want to replace the core of the canopy with an imposter. In the image below some of these density faking meshes are shown separated to better get an idea.

Tree canopy density imposter meshes

Tree canopy density imposter meshes. An outer layer of foliage is kept. In the canopy core tons of real geometry have been replaced with density meshes. At LOD-1 this tree has now only 5'834 triangles or 33% of the base mesh. The outer layer shows well why removing foliage alone is a problem.

The savings range from 25% to 35% of the original triangle count. This is a saving of around 10'000 triangles for each tree when it hits LOD-1. On an alley with 10 trees at each side this is already a saving of 200'000 triangles. Not to be sneezed at for resulting in little visual impact. Obviously more heavy LODing can be done for LOD-2 since at this distance more or less only the shape of the tree remains. The imae below shows a comparison of the LOD-0 version of 5 variations of a tree with the LOD-1 version. The difference is barely visible but the saving in triangles is tremendously. Still at up close the trees show up at full quality. Furthermore the LOD-1 mesh is selected already at a couple of meters away due to the density meshes matching the lost vertices inside the canopy quite well.

Comparison of Tree at LOD-0 and LOD-1 using Tree Canopy LOD

Comparison of Tree at LOD-0 and LOD-1 using Tree Canopy LOD. Visual difference is neglectable but the saving is tremendous. Without the density meshes the canopy would be very transparent and holed creating huge visual difference.

You could leave a comment if you were logged in.
gamedev/treecanopylod.1557354336.txt.gz · Last modified: 2019/05/08 22:25 by dragonlord