POV-Ray : Newsgroups : povray.text.scene-files : Simple recursive tree macro Server Time
2 May 2024 13:45:00 EDT (-0400)
  Simple recursive tree macro (Message 1 to 2 of 2)  
From: quickfur
Subject: Simple recursive tree macro
Date: 5 Feb 2007 11:30:01
Message: <web.45c75aae68390bf6dd5364bf0@news.povray.org>
This is the code for the tree images I made for JS's "challenge" on
p.b.images. The two images I uploaded are only samples of what
the tree macro can do; there are some parameters at the top of
the file that can be tweaked to create different trees.

Of course, the whole point of this exercise is to create as many
objects as possible in as few lines of code as possible while still
making an interesting scene out of it, so don't expect this code
to be anywhere near the league of the maketree() macro. :-)

In interest of code size, I decided to forego the ground (which
would then have required some non-trivial background scenery
in order to avoid the drudgery of Yet Another Infinite Plane,
etc.). Instead, I chose the camera angle so that it gives an
illusion of the tree being firmly planted in the ground even
though it is actually floating in midair. :-) It all depends on
your Point Of View, as they say. This also allows for the
branches to be dimly illuminated from below in order for
their geometry to be a little clearer, since most of the light
is otherwise completely blocked off by the spherical leaves.

The only non-trivial texture is the sky_sphere, although of
course the tree would look better if it had some actual wood
texture and had more leaf-like shapes for its leaves. This is
left as an exercise for the reader. ;-)


Post a reply to this message


Attachments:
Download 'short01.pov.txt' (1 KB)

From: lkreinitz
Subject: Re: Simple recursive tree macro
Date: 27 Feb 2012 22:05:00
Message: <web.4f4c43abdd5d35e41e513d6b0@news.povray.org>
A slight mod to the 'Leaf' bit

  union {
cone { <0,0,0>, 0.15, <0,1,0>, 0.05 }
sphere { <0, 0, 0>, 0.5 scale <6,.1,1.5> rotate 120*y translate y pigment { rgb
<.2, .6, 0> } }
sphere { <0, 0, 0>, 0.5 scale <6,.1,1.5> rotate -120*y translate y pigment { rgb
<.2, .6, 0> } }
sphere { <0, 0, 0>, 0.5 scale <6,.1,1.5> translate y pigment { rgb <.2, .6, 0> }
}
}

Makes a semi believable leaf


Post a reply to this message


Attachments:
Download 'tree_test.jpg' (64 KB)

Preview of image 'tree_test.jpg'
tree_test.jpg


 

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