This page describes the workflow for editing and previewing LOD (level of detail)
Level of Detail (LOD) is the process of simplifying the geometry of the tree as the tree gets farther away from the camera. This common practice increases performance in real-time applications. The SpeedTree SDK handles LOD automatically at run time, but the settings for LOD must first be tuned in the SpeedTree Modeler on a per-tree basis. Branches, fronds, leaves, and zones can all have LOD applied to them.
|Automatic Level of Detail is a feature of SpeedTree For Games only. SpeedTree Cinema and SpeedTree Studio only have LOD controls for degrading the tree's individual generators at a single level of detail state. However, it is still easy to change the detail of the tree in Cinema and Studio by changing generator LOD values, but multiple resolutions will need be configured manually in separate SPM files.|
To enable LOD, select the 'Tree Generator' and turn on the Enabled property in the “Level of Detail” group. All other global LOD properties are housed here as well – Preview style, Count, Near and Far ranges, etc.
To change the current LOD state in the 'Tree Window', either manually slide the LOD Indicator up and down (Preview style → Manual) or zoom in and out from the tree (Preview style → Use near and far). The LOD Count must be greater than 1 to see any change.
All branch, frond, and leaf LOD controls are located in the “Level of Detail” group of the generator. The majority of the polygonal reduction depends on the LOD curves for each property – the left side of the curve is highest LOD, and the right side is lowest LOD.
Our spine LOD method is two-fold; to reduce the number of segments on all nodes while removing a few nodes at fixed distances from the camera.
Within the “Level of Detail” property group of a spine generator, bring down the right endpoint of the curves for Length segments, Radial segments, Cap rings, Frond shape segments, or simply use the Segment multiplier to have less segments at lower LOD's. To reduce “popping” between LOD's (there is no transition for segment reduction), preview the results and edit the curves until the change from one LOD to the next is not too noticeable.
Optimization can be increased during level of detail changes. Often simply increasing the LOD Optimization amount results in less noticeable transitions when compared to using the segment multipliers described above.
We perform LOD branch and frond removal by shrinking the radius of branches and reducing the width of fronds with distance until they are no longer visible. Once the branch or frond has reached zero area, it is removed.
To remove branches as the detail level decreases, complete the following process:
1. Set the maximum threshold value (1.0 meaning all branches/caps will survive) for the highest level of detail.
2. Use the associated LOD curve to shape the amount of geometry that will remain at each discrete LOD state. The left side of the curve corresponds to the highest (full) LOD while the right side of the curve corresponds to the last (lowest) LOD. Usually a “linear decay” or “droop” curve preset works well.
For instance, if you use a “linear decay” curve on a tree with 3 discrete levels of detail, the highest LOD will include all branches/caps/fronds, the second LOD will include all branches that have greater than half the volume of the largest possible branch (fronds and caps work the same but with area instead of volume), and the last LOD will not have any branches/fronds/caps.
|If you do not want to remove ALL of the branches with LOD, make sure to raise the right end of the associated LOD curve higher than zero (the bottom of the curve). Thresholds are not a percentage of the number of branches, but instead are scalars used to check the value of the curve against the maximum volume or area found in the generator. This allows you to easily remove small inconsequential branches from the tree before major branches.|
To exclude a node from being removed by LOD entirely, we've provided a node level property called Keep override. When enabled, the node never be removed due to LOD.
Our leaf LOD method involves reducing the number of leaves at fixed distances from the camera, while increasing the size of surviving leaves to help maintain the same leaf cloud volume. Leaf LOD is “smooth”, meaning that the transitions should not be very noticeable.
You can tune the behavior of leaf reduction with the properties in the leaf generator's “Level of Detail” property group. The minimum amount of leaves at the lowest LOD is governed largely by the Keep property. A “keep” value of 0.0 will result in no leaves remaining on the tree at the lowest LOD. To avoid this, raise the value up from zero until enough leaves are left to cover the original leaf cloud volume. If the surviving leaves are too small to bridge the gaps, increase the LOD Size scale value. Be sure to preview final LOD at the lowest level by dragging the LOD Indicator all the way down while in manual Preview mode. To randomize the results at lower LOD's, either change the Level of detail seed value (in the “Random seeds” group), or change the Fuzziness value until you've gotten the desired results.
Like with branches and fronds, leaves can be forced to survive LOD by enabling the Keep override node property.
Leaves and fronds that are using mesh assets can utilize up to three different LOD meshes to switch between during the LOD progression. The three available mesh LOD slots are labeled as follows:
|Since mesh assets are arbitrary in nature, no smooth transition algorithm is available when switching between meshes; it is entirely up to the artist to model a set of meshes that are geometrically similar enough to not cause bad “popping” artifacts.|
Once LOD geometry has been imported, it is up to the individual generators and nodes to choose which mesh to use for any given LOD state. This is controlled via two similar properties; Mesh index on leaf generators, and Frond mesh index on spine generators.
How to interpret the (0 to 1) Mesh index value
The numeric value portion of these two properties controls which LOD mesh will be used at the highest LOD. However, keep in mind that this value is not a direct index value corresponding to [0 = Main, 1 = LOD 1, or 2 = LOD 2]. Rather, it is a percentage of the entire LOD mesh set. That is, a value of 1.0 would correspond to mesh in the “Main” slot. Since there are three LOD mesh slots available, a value of 0.66 would correspond to the next LOD mesh, “LOD 1”. Finally a value of 0.333 or lower would result the mesh in the “LOD 2” slot.
The mesh index LOD curve follows the same logic. When the curve is evaluated at a particular LOD state (the 'Y' axis of the 'Curve Editor'), its 0 to 1 value in the 'X' axis is used to retrieve the correct LOD mesh as it corresponds to the same percentage along the LOD mesh set.
Starting with version 6.0, Zones and mesh forces can also take advantage of mesh LOD. Both contain a single LOD property, simply labeled Level of detail. This LOD curve controls the mesh index used by either the zone or mesh force at any given LOD state, in exactly the same manner as described above in the Mesh LOD → Controlling the Mesh Index sub-topic.