User Tools

Site Tools


Leaf Collision

When a tree is generated procedurally, it may end up with leaves “colliding,” or intersecting, with other leaves and branches. The SpeedTree Modeler has features to detect these collisions and remove them.

Removing Collisions

Leaf collision removal is enabled in the toolbar of the Tree Window. You have a few options for the kind of collision tests performed:

None No action.
Low Most leaf-leaf collisions are eliminated. Leaf-branch collisions are ignored (fastest).
Medium All collisions are eliminated by a rough intersection test (intermediate speed, but this option can remove too many leaves).
High All collisions are eliminated by an exact intersection test (slowest).

Collision removal works as a background process to prevent you from having to wait to continue editing your tree. Once it is finished, the results will pop in. Every time the leaves are changed, collision removal will re-run automatically. An example of the results of leaf collision removal are shown below:

collision_removal.jpg

When Using Clusters

On real-time trees that use Clusters, collision detection becomes a little trickier. Cluster geometry, such as that made with the Cutout Editor, often contains a lot of transparent parts, since the map includes many leaves and twigs. Exact tests on this geometry may remove a lot more leaves than you would want, since parts of the geometry that are touching may not matter so much.

In this case you can enable “Use spherical tests on leaves.” This will replace the exact geometry tests with a spherical test. It will be faster, and it will leave behind more leaves. You can adjust the size of the spheres that are tested by changing the "Sphere threshold" property on the leaf generators.

When Making Clusters

Similarly, when making the clusters, a different type of collision detection is warranted. Cluster maps often work better on a tree if they have fewer overlapping leaves.

The collision detection options listed in the “Cluster plane overlapping” submenu are similar to the main options. However, they apply only to intersection tests done in the top-down (XY) plane. In this way, you can be sure your cluster maps have few overlapping leaves.

Refining Collision Behavior

To further refine the results of leaf collision removal, individual generators such as the Leaf Mesh Generator and Batched Leaf Generator have additional properties pertaining to collision. These properties can influence which leaves “win” in a collision fight, which leaves are tested against which other leaves, and what happens to leaves (and possibly their parent nodes) when they lose.