# L-systems 101

Lindenmayer systems are a formal grammar for describing branching structures and the best way to model plants!

## Branching Basics

The key to l-systems is branching. L-systems are defined as a series of rules which are evaluated in sequence. This sequence describes the direction, length and splitting of the branches. The basic anatomy of an l-system:

**Generations**: Age, or how many iterations have been processed**Premise**: The initial path**Rules**: The rules which are executed each generation

Within the rules, there are many ways to direct the branches. The basic instructions such as pitch, angle, yaw, scale, branch, and spawn geometry apply to L-systems in general. Most software implementations have their own functionality unique to that application, and Houdini’s is pretty robust.

### Syntax

The syntax of the rules was established originally by Lindenmayer, and are pretty consistent between implementations. The full syntax for Houdini is documented in SideFX’s L-system writeup. The elements used here are

F : Age, or how many iterations have been processed " : Scale down (set to 0.7) [] : Branch +/- : Turn right/turn left

So, starting from one line forward, each generation the line scales down to 70%, creates a branch to the right with a branch at the end, and creates a branch to the left with a branch to the end. The recursive use of rules is fundamental to generating visual complexity with l-systems.

Animated growth of a very simple 2D l-system:

Animated growth of an l-system with a third dimension of rotation:

## Growth and Probability

By modeling plant species with l-systems, you get **two dimensions of variation**: growth and probability. For the purpose of producing assets for games or film, it provides the main benefit of procedural modeling of infinite variations on an asset.

### Growth

If the l-system is written to represent the plant growing, then each generation can be baked out as its own asset. When used in a large group of assets, such as a forest, they can represent having plants of different ages and add a sense of realism.

### Probability

There are different ways of using probability with l-systems, but the main method is having multiple definitions of each variable in the rules with a probability assigned to each definition. With a random seed value you can export infinite versions of the same species.

## Organic Form

With just a little bit of probability, it’s easy to make a pipeline for some solid similar-but-different assets. With a bit more time and customization, you can generate a realistic forest or art direct organic forms that would be impossible to model by hand. Setting down rules and not knowing exactly what will come out is part of what makes working with l-systems very compelling!