
Growing Trees
I’ve been playing with procedural tree growth recently. The method I am using is based on Self-organizing tree models for image synthesis, by Palubicki et al. (SIGGRAPH 2009).
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
I’ve been playing with procedural tree growth recently. The method I am using is based on Self-organizing tree models for image synthesis, by Palubicki et al. (SIGGRAPH 2009).
The idea is beautifully simple: buds compete for light, the tree distributes a growth resource among them, and the successful ones produce new shoots. Those shoots change the light available for the next round. The crown shape emerges from this feedback loop.
Here is a quick breakdown, with some visualizations from my implementation.
The basic building block is a metamer: an internode (a short piece of stem), a leaf, and the buds at its upper node. A terminal bud continues an axis, and axillary buds may start lateral branches.
Each iteration represents one growing season:
One way to approximate light availability is a voxel grid. Each bud adds shadow to a widening pyramid of voxels below it, with its contribution decaying with depth. Contributions from all buds add up, so the interior naturally becomes darker as the tree grows.
Each bud reads two things from this grid: an available-light value (Q), and a direction (\mathbf{V}) toward the least shaded neighboring voxel inside its perception cone.
The paper also supports space colonization: fill an envelope with marker points, let buds compete for nearby markers, and remove markers as growth occupies their space. Same growth machinery, a different way to decide where growth is possible.
Light values are first summed down the branching structure. At the base, the total (Q_{base}) becomes a growth resource (v=\alpha Q_{base}). This resource travels back up, splitting at every branching point.
In the extended Borchert-Honda model, the main continuation receives:
The lateral side receives the remainder. At (\lambda=0.5), resource follows light. Larger values favor the main axis. Smaller values favor the laterals.
This little bias has a surprisingly large effect:
A bud receiving less than one unit stays dormant. Otherwise it produces a shoot of (\lfloor v\rfloor) metamers, subject to a configured cap. New metamers receive their own buds, and the process repeats. Magic!
Each new segment follows a normalized weighted sum of its previous direction, the light-seeking direction (\mathbf{V}), an upward or downward tropism, and some noise. A horizontal component can make lateral branches spread into flat tiers.
Bud placement around the stem (phyllotaxis) provides another important control. Spiral arrangements, opposite pairs, and annual whorls produce very different branching patterns. The frame is parallel-transported along the shoot so the arrangement stays coherent as it bends.
With the shadow model, a lateral branch is shed when the light collected by its subtree, divided by its metamer count, falls below a threshold. Young branches get a grace period. Otherwise the inner crown would keep accumulating starved twigs.
Branch thickness comes afterwards, using a pipe model:
Start with a fixed radius at the tips and accumulate toward the root. For (n=2), cross-sectional area is preserved at junctions. Larger exponents produce slenderer trunks. Shed branches still contribute to the girth below them. Losing a branch does not make the trunk shrink.
Width and passive sag are calculated from the grown skeleton and do not feed back into growth.
The skeleton becomes a bark mesh by sweeping tubes along its axes. For foliage I use twig spray cards: each card depicts a small twig carrying several leaves, using variants from a procedurally drawn atlas.
Blending the card normals toward an ellipsoid around the crown helps the foliage shade as a volume. Lower detail levels retain fewer, larger cards and simplify the bark. At a distance, baked directional impostors take over.
Bonus: The grown tree can also be baked into depth-field views for forest rendering. The image below uses many instances of one baked linden, with size variation. The forest representation and lighting deserve a separate post, though.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。