POV-Ray : Newsgroups : povray.advanced-users : Making plants Server Time
29 Jul 2024 14:24:32 EDT (-0400)
  Making plants (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Ken
Subject: Re: Making plants
Date: 25 Aug 2002 23:02:21
Message: <3D699AEB.F99D933B@pacbell.net>
Rohan Bernett wrote:

> 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.

My advice would be to look through the various tree include files you will
find here and look for inspiration from what others have done. You may
actually find you don't need to reinvent the wheel and someone already
has something you can use.

http://www.povray.org/resources/links/POV-Ray_Include_Macro_and_Object_Files/

-- 
Ken Tyler


Post a reply to this message

From: Christopher James Huff
Subject: Re: Making plants
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

<<< Previous 10 Messages Goto Initial 10 Messages

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