I believe in binary Zen. You're either at one with everything, or at zero with everything.

Inkscape Tutorial - Trees

Date/Time Permalink: 07/22/07 08:38:46 am
Category: Graphics Tutorials

NOTE As of 2011, this tutorial is outdated. See my updated tutorial on using Inkscape's L-System dialog for an alternative method of generating tree structures.


Fractals have a long history of fascinating computer and math geek alike, but this time we're going to take the way a fractal simulates natural ordered chaos and apply it to the practical purpose of drawing a natural object! However, this isn't going to be a very realistic tree, just a drawing good enough for an icon or a game sprite.

I'm assuming you know the basics of Inkscape editing. If not, head on over the one of the best manuals for any graphics tool I've ever read, "A Guide to Inkscape". This tutorial also makes heavy use of the 'effects' plug-ins in Inkscape 0.44. Not only are the effects items being changed and shuffled around between versions, but they also require that you have the PyGTK library. In short, I'd recommend finding a GNU/*nix system which already has all of this installed and configured for you. I did it all manually a while back on Slackware, which I remember as being a painful experience.

Anywho - if your system doesn't have the exact same names and menu configuration, hopefully you can adapt this and follow along.

How to draw trees in Inkscape:

We'll mainly use two Inkscape tools: 'random tree' to make the trunk, and 'fractal (Koch)', used to make the foliage.

1. Effects-> Render-> 'Random tree' gives you a slightly different tree within the two parameters you specify. The 'initial size' parameter will be the overall size of the tree, and the 'minimum size' parameter will determine how many times the branches fork on average. This is easier to demonstrate than explain, so here's some typical examples:

first random tree

second random tree

third random tree

Yes, lower numbers for 'minimum size' give you more branches. Is this a bug, or were they just playing with us?

Of course, these objects are paths, so if you didn't get the exact shape you had in mind you can always use the node edit tool to alter it.

When you have the branches in the position you want, conform your stick diagram into something more like a real tree by selecting it, hitting Ctrl-L a few times to smooth the path, then Ctrl-) (Control-Shift-right parenthesis) to outset the path. Maybe outset it a couple of times to get a thicker trunk.

tree tutorial step 1

2. Move to another space in the drawing and use the Bezier lines tool to draw out a line segment with a couple of angles in it. We're going to use the C-curve method. Something like this:

tree tutorial step 2

3. Now with the segment selected, pick Effects-> Modify Path-> Fractal (Koch) load pattern. The pattern will load, taking a second. Select the segment again and Effects-> Modify Path-> fractal (Koch). Repeat that last move a few times.

tree tutorial step 3

4. When you have the top of the foliage shaped, hit Ctrl-D to duplicate it, hit Ctrl-] (Control- square bracket) twice to flip it over, move it below, but overlapping, the top shape. Then select them both and hit Ctrl-+ (Contol-Shift-plus) to paste them together.

tree tutorial step 4

5. The shape you probably ended up with looks a little too geometrical, so let's rough it up. Go Effect-> Modify Path-> Radius Randomize. Use a value of between 5.0 and 10.0 in the dialog. this will stagger the path's nodes, making it a little chaotic. You can then smooth it a little with Ctrl-L a couple of times.

tree tutorial step 5

6. Use the fill 'n' stroke dialog to change the colors of the tree parts (I kept them in black outlines so you can see how they go), and bring them together. Hit Page-Up with the trunk selected to move it onto the layer on top of the foliage.

tree tutorial step 6

7. Here's the finished example after I exported the bitmap from Inkscape and got it into Gimp, where I ran some effects on it. The effects were the cloud noise and hurl filters on the foliage and bump-map on the whole thing, if anybody's interested.

finished tree

Now, this is OK for a quick drawing, but a realistic tree is beyond the grasp of this - and possibly any - tutorial. When it comes to natural elements, you get out of them what you put into them. Use this for a starting point for a basic technique, then elaborate to taste.

Here's one I've done with a lot more work put into it. In Inkscape, I did some detailed node editing after generating the shapes. I then exported three separate layers. In Gimp, I built the layers with the trunk sandwiched between two layers of foliage. I then applied a few more filters to rough up the texture of the various layers and different levels of bump-mapping to the front and back foliage layers. Then I finally just did some good old-fashioned brush work in Gimp.

improved tree

Follow me on Twitter for an update every time this blog gets a post.
Stumble it Reddit this share on Facebook

suddenly the moon