POV-Ray : Newsgroups : povray.advanced-users : Making plants : Re: Making plants Server Time
29 Jul 2024 16:33:59 EDT (-0400)
  Re: Making plants  
From: Christopher James Huff
Date: 26 Aug 2002 20:27:06
Message: <chrishuff-50BA50.20262726082002@netplex.aussie.org>
In article <web.3d69968af01f31b4d02c7b870@news.povray.org>,
 "Rohan Bernett" <rox### [at] yahoocom> wrote:

> I'm no good at writing recursive functions. :-( I've used them a couple of
> times in c++ in my uni assignments, but I always find them a pain in the
> arse to write.

It isn't too difficult, and there are many examples of this technique in 
the various plant generator include files.


> Okay, enough grumbling, can anyone give me some advice (or better still a
> code exaple) on how to make a tree using recursive functions. My best
> vaugly recursive attempt at making a tree involved making several objects
> of different levels of the tree and adding them at different levels. i.e.
> one level with leaves, then one using branches with 3 leaves on them, then
> one using 3 branches from the one before and so on. It does look like a
> tree, but not very realistic.

You need to use more randomness...real plants don't branch precisely a 
certain number of times at exact intervals with straight stems in 
between. In my systems, I only branch every once in a while, each 
recursion has a certain probability of branching. I also added various 
forces such as gravity, wind, light, etc. Start out with a simple 
framework and add rules and tweaks to it.

Also, be aware that POV can only recurse a certain number of levels, my 
technique recurses very deeply so I hit this limit hard. You can mimic 
virtually unlimited recursion by using something more like a particle 
system where each particle traces out the path of a limb and splits into 
two particles to branch. I've been playing with this, but my system is 
written in Sapphire, not POV.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.