Lindenmayer Systems allow one to specify a series of replacement rules for transforming strings.

If the text is used as a series of drawing commands, including saving and restoring the cursor’s position, the technique can generate fairly interesting foliage.

A scene graph offers the ability to save/restore by chaining segments together. I used Unity3D’s ScriptableObject to create “Languages” with replacement rules. I also created “Dictionaries” mapping symbols to segments made from GameObject prefabs. Finally, I explicitly marked a node in the segment as being the Leaf to which any successive stuff should be attached.

By allowing multiple overlapping rules, I let the system show a lot of variances. I added “Soar” mutilators to tweak the spawned things and show some more variance. By tweaking the “seed” value with the world position, I ended up with something that could use the same prefab to produce a whole forest of trees.

Overall I’m happy to move forward with this as a tool for filling in my own virtual forests. I think that it needs some work on the “usability” and could stand to take some lessons from Unity3D’s built-in tree system. Seems pretty good for a Saturday afternoon bit of messing about

Peter LaValle avatar
About Peter LaValle
Peter is currently a PhD student at the University of Nottingham. His day work involves applying functional programming to problems with artificial intelligence. Someday maybe he'll retire and be a graphics programmer or demoscene coder.
comments powered by Disqus