Interactive L-Systems

lsys_trees

L-Systems are an effective Method to describe rules for procedural generation of objects and are often used to model growing plants. They consist of a set of ordered replacement rules that are applied to a string describing the desired objects. Repeated application of the rules changes the string step by step to form a new generation of the object. The effective form of the object depends on the interpretation of the strings characters. For more complex structures the characters in the string are replaced by complex modules that can contain e.g. rotation angles of a tree branch or the amount of nutrition stored. Such rules are good at describing branching patterns and growth of fractal objects like trees. L-Systems have been extended to be ‘context-sensitive’ to make the described objects react on their own structure. Other extensions include reactions to the surrounding environment by writing rules that handle nutrition or light for plants or even collision calculation for tree branches.

However those extensions are not always practical to work with in explicit environments. The more features are added to the rules the more complicated they become to write. This is especially problematic since the rules only reflect on changes of small parts of the described object and not on the object as a whole. An even bigger problem is that changes e.g. to the physical behavior of a simulation requires rewriting the rule sets of all objects. As an alternative this project uses a two sided approach. The general growth based on nutrition and direct interaction is modeled in the replacement rules and replacement operators. But feedback interaction like collision with physical objects is handled after the procedural structures have been interpreted into objects that can be used in a physics engine. The reaction calculated in the physics engine is then translated into corresponding modules. This way the loop is closed and the updated physical form of the procedural structure can be used for the creation of the next generation. In the following example a tree is confined in a box by creating new modules in its description directly from the physics calculation. The rule sets for the unconfined tree and the one that bends when it reaches the walls of the box only differ by a few lines of code for activating the intersection calculation.