Saturday, November 20, 2010

2D Tree generation algorithm

I've been working on a tree generation algorithm since yesterday (after having a couple of ideas I wanted to try for a week now). 

It's based on a particle engine rather than fractals (which seem to be the most common method of procedural tree generation I encountered online). I searched if anyone had a similar approach but couldn't exactly find one (there is one that uses particles for the leaf textures, but not for the entire tree building).

So here goes, it's a little crude and it would probably still need some fine tuning to remove obvious artifacts and oddities but I think it works rather well in 2D that is. I hope it will scale well to 3D, I think it should due to the nature of particles but until I have finished that and found some acceptable results I won't take it for granted.

I made a quick step by step of the algorithm, or rather the behaviour of the different particles used.























And here are some results:












The algorithm is a hybrid between cellular automata and a particle engine. While it uses particles to draw the tree, they can also be interpreted as individual cells with behaviour like cellular automata do.

--Dwight