L-System Introduction

http://algorithmicbotany.org/papers/#abop

In class, we discussed coding techniques that we could use in our projects and our lecturer (Sokol) suggested I look into Lindenmayer systems to generate my Tree. I find the idea of being able to have my tree grow over time very appealing and is a far cry from the restricted step by step tutorial I had in mind for my project.

Since finding out about L-systems I have watched a few videos including this one video above that shows the L-system growing over time made in Javascript (there GitHub download was broken), as well as 3D l-systems like TreeSketch and ones found on http://www.algorithmicbotany.org/TreeSketch/ and semi interactable unity example on the unity asset store.

3D L-System

In Class Sokol gave us a step by step tutorial talking us through creating the sets of rules (the axioms) and the dictionary that defines those rules with a String builder. I didn’t think I got it to work at first but realised, later on, I just needed to zoom out and I had what you could just about call a tree, Just without deviations, a third dimension, leaves, growth or colour.

I noticed that the sidebar was filled with branch prefabs and found that I could instantiate them as children of the pot by using the above. I think later on I could use this to have branches understand their hierarchy in that when an older branch that is higher on the hierarchy is cut the children of that branch will fall off. However, my understanding of the system right now has it so that when I edit a branch it all branches in its iteration.

I created this script to make it easier to view the l-system in-game view. which rotates the camera around the pot by drawing the mouse across the screen. I did this by using the distance between where the mouse clicked and the mouse currently is.

I then created two scripts, one from the orbit around the Y-axis (up and down) by clicking and dragging the screen and the other so I could zoom in and out. At first, my zoom script moved the cameras transform position but the meant the camera would clip through the leaves so I edited the cameras FOV instead and had it bound to the mouse scroll wheel.

Weatherproof Bonsai Rotating Platform

Now that I had set up a rig that allowed me to view the L-system. Iv had to think more about how this will work with a VR player. The XR camera isn’t something I have to worried about however if the Bonsai is on a table, as is the player would have to walk around it. I rather the player be able to use a turntable to rotate the tree as they work on it. I thought having the branches parented to the pot as I had done previously would mean I would just need to change the rotation of the camera to the rotation of the pot. However, because the l-System position is determined only at the Start the rotation of the pot would be implemented after restarting the game. So I would need to put it in an update function to have it rotate the way things are right now but that I feel would scale poorly and be incredibly taxing on the system especially running in VR. I Tried to detect if the tree was moving with an exterior script that would detect if the tree was moving and call an update. this didn’t get me anywhere.