Biologically Inspired Procedural Growth Engine
By: Evan Favis, December 28, 2022
Overview
Developed a custom 2D simulation engine to model the algorithmic complexity of tree growth. The project explores the intersection of algorithmic procedural generation and natural heuristics, moving beyond simple fractals to include physical constraints like collision detection, gravity-defying rotation, and resource allocation.
Motivated by a fascination with time-lapse photography and natural systems, I spent my high school years engineering a custom growth simulation. This project served as a deep dive into the intersection of biology and computer science, transforming a personal interest into a functional technical application.
Milestone 1: Recursive Growth & Thickness Logic
Advanced Algorithmic Thinking Recursive Functions Bi-directional Systems Conditional Logic GatesThe core engine utilizes a recursive branching function. To simulate realistic maturation, I implemented a bi-directional growth system
- Growth entities traverse existing segments to append new geometry at the terminal nodes for vertical expansion
- A conditional logic gate ensures segments gain girth before further vertical growth is permitted, simulating the structural integrity required to support new branches. This is vertical expansion (thickness)
Milestone 2: Optimization of Collision Detection
Performance Profiling Bottleneck Identification Algorithmic Trade-offs Trigonometric Optimization Complexity ManagementAs the simulation complexity grew, standard trigonometric bounding box calculations became a computational bottleneck.
- I transitioned to Axis-Aligned Bounding Boxes (AABB) based on extremal coordinates for optimization
- While slightly less granular, this optimization reduced CPU overhead by 400% without sacrificing the visual integrity of the simulation
Milestone 3: Structural Self-Correction & Phototropism
Corrective Algorithms Global State Management Bio-Mimicry & Applied PhysicsTo prevent "unnatural" growth patterns, I engineered a series of corrective algorithms
- Angle Protectors: Prevents branching overlaps at the point of origin.
- Global Equilibrium: A balancing function monitors the stem count on either side of the central axis, applying a subtle rotation to the base to maintain a natural silhouette.
- Sharp Angle Correction: Inspired by phototropism, the program detects angular thresholds between adjacent segments and applies a rotational force to "straighten" the limb over time.
Milestone 4: Leaf Synthesis & Rendering Stability
Debugging Visual Systems Coordinate-based Logic Deterministic SeedingThe final layer involved a leaf-generation system
- The Problem is that dynamic stem movement caused high-frequency flickering in leaf shaders
- My solution was to implement a coordinate-based deterministic seed. By calculating leaf color values based on f(x, y), the properties remain stable as long as the position is constant, eliminating flickering without the memory overhead of a tracking database