meta data for this page
  •  

GPU performance

There is a great deal of flexibility in the SDK for tuning CPU and GPU performance. This page outlines some approaches. For information on optimizing memory usage, see Keeping Memory Usage Low.

Level of detail (LOD)

GPU performance is perhaps most impacted by the overall LOD settings of a given forest. In the reference application, there is a global LOD scalar, world::tree_lod_scalar in the example forest .sfc file. The closer the LOD, the more obvious the dynamic LOD adjustments become, so a balance must be struck. No other single adjustment will impact the frame rate as much as scaling the LOD parameters down.

Wind

SpeedTree's wind system is configurable and, while not set up this way in the reference application, can be modified to gradually scale off more complex wind effects up close to simple swaying effects at a distance – all without any pop as the effects gradually change. Also, having a variety of vertex shaders with different effects enabled (some for hero trees, others for shrubs) can greatly reduce the average vertex shader complexity per model in a scene.

Texture sizes

The SpeedTree games model library comes with very high resolution textures. Be sure to use the texture controls on the games export dialog in the Modeler to keep the output textures at a reasonable size. Controls are available for the overall outputs, per 3D and billboard atlases, and individual textures within the atlases.

Unique model count

While it's tempting to put 50 or more unique .stsdk files in a given scene, it's far more efficient to use fewer models. For a given forest of one species, for example, 3 to 5 unique .stsdk models randomly scaled and rotated go a long way. The wind system can make each instance behave uniquely so there will be no two instances in perfect sync, strengthening the illusion of more unique base trees.

Individual atlases

For most platforms, it's better to use unique 3D and billboard atlases, as long as the space is used judiciously. It makes it far easier to mix and match compiled trees too, as trees compiled into an atlas with others aren’t nearly as relocatable. Plus, there's less wasted space when using multiple smaller atlases as opposed to a few large ones.

Overdraw

For dense forests, overdraw can get out of hand quickly. Be sure to have the artists trim as many interior leaf triangles as possible. Having minimum shader effects on the leaf geometry will also help. When possible, render front to back.

Depth-only pre-pass

If warranted in your game engine, consider a depth pre-pass. It can make a big difference in the overall render speed in forward or deferred mode, especially when cascaded shadow maps are used. The reference application ships with example depth-only shaders.

Draw distance

Keep the draw distance as short as possible. Draw distance mostly impacts the number of billboards rendered and will dramatically increase the amount of vertex buffer space used for the instance lists. Remember that the number of billboards rendered will increase exponentially as the draw distance increases.

Use the grass system

Take advantage of the grass system. It's very convenient to use for any sort of ground clutter and cover, be it grass, weeds, rocks, broken twigs, litter, fallen leaves, etc. While the reference application places these instances procedurally, you are free to place them according to any rules you wish, which may circumvent having to store specific locations for every model.