User Tools

Site Tools


Leaf Collision

Leaf collision is used to optimize the placement of leaf cards and meshes.

Overview

With most typical tree models, leaves are the bottleneck in rendering performance (particularly in real-time tree models). This is due to two main factors: high polygon counts and overdraw. The properties in the “Leaf Collision” group on the 'Tree Generator' address both of these issues by handling cases where leaf primitives get too close together. Leaf collision is always delayed until after parameter editing stops.

Both techniques described below are computationally expensive and may be prohibitively so on high resolution tree models (e.g., models targeted for off-line rendering only). Disabling leaf collision on such models will greatly improve computing performance. Consider using degradation in this case to disable leaf collision temporarily while modeling.

Spreading

In order to reduce overdraw, colliding leaves can be spread out to provide better coverage. No leaves are added in this process; rather, the existing leaves are repositioned so that the shape of the leaf cloud is roughly maintained but no two leaves are as close together as they were before the spread computation.

The process works in this fashion:

1. All leaf positions are computed based on the parameters on each leaf node.

2. After the compute is over, colliding leaves are identified and pushed away from each other in an iterative process.

3. How far they are spread is controlled by the “Spread factor” property.

Spreading leaves is a relatively slow process and is triggered either by pressing the Spread out button or automatically.

Leaf collision can be disabled altogether either by toggling 'Enabled' in the Leaf Collision property group or as a degradation setting.

Culling

In order to reduce polygon counts and overdraw, leaves can be eliminated when they get too close together. When any two leaves that are within the Cull tolerance are detected, one of them is removed. No leaves are repositioned in this process. Use culling to “thin out” the leaves on a tree.

Culling leaves is a relatively slow process and is triggered either by pressing the 'Cull' button or automatically.


Spread & Culling Scalars

Each leaf generator has a 'Spread' scalar and a 'Cull' scalar for the global spread and cull tolerances described above. To access the scalars, select a leaf generator and in that generator's Properties Window go down to the “Placement” group. The scalars work in this fashion:

  • Values less than 1 mean that a particular leaf generator is less likely to be culled (or spread) when colliding with other leaf generators, and decreases the collision tolerance for leaves within the generator.
  • A value of 0 means that under no circumstances will the leaves in that generator be culled (or spread). This is useful for “hero” leaf meshes (such as hanging moss) which should not be culled during leaf collision – and likewise should not cull other leaves either.
  • Values greater than 1 increase the likelihood that that particular generator will get culled when colliding with other leaf generators, and increases the collision tolerance for leaves within the generator.


Automatic Leaf Collision

Spreading and/or culling can be scheduled to happen after any property edit using the 'Automatic' property. When both are done automatically, be sure to choose which happens first carefully. If culling happens first, more leaves will be removed and less spreading will happen. If spreading happens first, the leaves will be more spread out but fewer will be removed.

Note: The option for the 'Automatic' property applies to all the leaf generators rather than each individual generator. There are two ways to access the Tree Leaf Collision Properties. One is by going to the Tree Properties and scrolling down to the Leaf Collision tab. The second way is while you are in the individual generator's properties, you scroll to the Placement tab and select 'Edit Leaf Collision'. Selecting this button will automatically open the Tree Leaf Collision Properties.


Node Edited Leaves

If a leaf has been manipulated while in node selection mode, it becomes exempt from being spread or culled. The theory is that if you hand-edited a node, you intend the keep that node around! Otherwise, it would have been deleted. The spread is set to be ignored, because otherwise the leaf would move out from underneath you as you change its position or rotation (since the spread calculation probably would influence it if it collides with any other leaves). The leaf can be set to use spread again, by changing its node property for Ignore spread to false. To make it cullable again, press the 'Clear node edits' button at the top of the 'Property Editor'. (Must be in the individual leaf/node properties to have the 'Clear Node Edits' button option available at the top of the Property Editor.) In order to clear all the node edits for a specific generator, right-click the desired generator and select 'Clear Node Edits'.