A while ago I posted about procedural generating a city. To make it less boring, we added procedural trees – without leaves.

So, where do you start when you want to generate a tree from scratch. Well, first let examine a tree, you have a trunk that goes into the ground. This can be represented by a cylinder that get narrower at the top. Then you have branches, they start at some position at the trunk and also get narrower at the end and can be represented by a cylinder. So we now have we trunk and a branch that can be represented the same way quite easily.

Now we only have to place the cylinders in the world. Placing is pretty easy as the trunk just can be straight and branches can go half way from the trunk to the side with some random offset. Also branches can have branches, so making the code handle this was not an issue and gives a very nice result. But all the branches are straight?! Not when you make them out of multiple cylinders and give them all a small random rotation, then they seem much more organic and gives a pretty nice result.

Leave a Reply

Your email address will not be published. Required fields are marked *