[Beginner] Creating Plants with touchdesigner! The most powerful L-system, branch version

miwa_maroon
5 min readApr 16, 2021

What is L-system?

Dr. wikipedia says

L-system (Lindenmayer system) is a formal grammar, an algorithm for describing and representing the structure of various natural objects, such as the growth process of plants.

It is a kind of formal grammar that can describe and represent the structure of various natural objects, including the growth process of plants.

I can make plants!

This time, you will be able to create something like this!

Let’s get started with touchdesigner and make it!

For now, let’s make one, and I’ll explain in detail later!
First, start up touchdesigner and delete all the default operators.
L-system SOP
To our surprise, touchdesigner has a SOP operator called L-system SOP.

How excellent.

So, let’s get started with the L-system SOP.

You’ll probably see something like this.

The SOP above allows you to tweak the angle, length, and other parameters of the plant.
The DAT below comes as an added bonus.
This is where you write the L-system’s own symbols to determine the shape of the plant.

Tweak the SOP.

Please set Geometry parameter of L-system SOP like this.

Similarly, the Values parameter should be set like this.

And to make it easier to see, let’s press the + button at the bottom right of the L-system SOP, and then press the w key on the operator.

Then, the wireframe view will be displayed. This is to make it easier to see (you don’t have to do it).

Write the mysterious symbols.

The next step is to write the mysterious symbols on the bottom DAT.
For now.
Replace the current code with the following

context_ignore:F+-
premise:FFFA

A=”F[-A]/// F[-A]/// F[^(10)A]

I know how you feel. I know what you’re thinking.

Don’t panic! .

I’ll explain it properly.

F moves on

First of all

context_ignore:F+-

You can ignore it.

The next one

premise:FFFA

Here, we use the symbol FFFA to indicate that we want to determine the shape of this plant.
This F goes straight up the XY axis plane. Thanks to this F, the L-system will grow.
FFF is followed three times, so the length of F is three times the length of F. This is what it looks like in the picture.

Branching.

Here’s another one I don’t understand called A.

Calm down!

It’s in the next sentence.

A=”F[-A]///F[-A]///F[^(10)A]

The first ”F is multiplied by the next F by the ratio Step Size Scale in the SOP parameters. It will be shorter by that percentage.

Here it comes, [-A].
[] is a branch, which is a symbol for branching.

The - in parentheses is a symbol for rotation. Specifically, rotate counterclockwise around the Z axis.

Here comes A again. This is the same as A in the previous example. If you have trouble understanding it, please refer to the figure below.

If you have a good intuition, you may notice something here.
The L-system uses this repeating mechanism to form branches.

Various rotation axes

Next comes /. This is also a symbol for rotation, but this time it is counterclockwise rotation around the Y axis.
By doing this, we can make the branch dimensional.

///F rotates the / three times and goes forward F.

When you say rotate, how many degrees do you mean rotate?
It’s Angle in the Value parameter of the SOP.

Then [-A].
Here it comes. Branch, rotate to the Z axis and create another branch.

///F.
This will proceed in the same way as before, rotating on the Y axis.

[^(10)A]
This is also the same branch as before, but with one thing you’ve never seen before.

^(10).

Simply put, it is a 10 degree counterclockwise rotation around the X axis.

You can use the rotation symbol -, /, ^ followed by a (number) to specify the angle.

### Summary of rotation symbols

axis | clockwise | counterclockwise
X-axis | & | ^ |
Y-axis | \ | / |
Z-axis | + | — |
Specify the angle with (number).
The default is angle.

Generations

After listening to the explanation up to this point, some of you must have thought, “If I keep repeating A, it will grow infinitely.

If I keep repeating A, it will grow infinitely.

But the growth is stopped, isn’t it?
What controls this is the following
This is controlled by Generations in the Geometry parameter of SOP (LDH lovers will be excited about this).
If the value is 1, A is not repeated, if it is 2, it is repeated once, if it is 3, it is repeated twice, and so on.
And so on to control the generations of growth.

Putting on the leaves.

I think I’ve created something similar to this so far.

It’s a plant, so it’s lonely with only branches.
Let’s add some leaves.

I’d like to add leaves, but I’ll leave that for next time.
The quality is going to get better and better from here!

See you next time at ↓↓↓↓
[Beginner] Creating Plants with touchdesigner! The most powerful L-system: Leaves

--

--

miwa_maroon

I want to bring a smile to someone's life. Use Touchdesigner.