NotesFalling Leaves

From the Blender tree to the demo

A GLB format for the tree, a converter from Sapling Tree Gen and a validator.

Before modelling the final tree, I defined what the GLB has to carry for the demo to understand it: an Armature with trunk and branch bones, the skinned mesh and almost rigid weights along each segment, so each leaf can follow a single bone.

With that I built three Blender tools: a script that converts a tree made with Sapling Tree Gen to that format, a validator that checks the scene before exporting and a generator of test trees with their expected values, to check that the demo reads them correctly.

The GLB can be meshopt-compressed, and it carries a simplified collider mesh so the pointer raycast stays cheap: against 45,000 triangles it took 58 ms, against a 2,000-triangle collider, 3.4 ms.