POV-Ray : Newsgroups : povray.binaries.images : my first tree Server Time
13 Nov 2024 20:34:37 EST (-0500)
  my first tree (Message 1 to 7 of 7)  
From: sap
Subject: my first tree
Date: 20 Oct 2004 15:06:15
Message: <4176b727@news.povray.org>
After a lot of try, i realesed a recursive
macro for make trees, just want to share it :)


#include "colors.inc"
#include "math.inc"
#include "rand.inc"

camera {

  location  <12, 2, -30>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <10,1,0>
}

light_source{< 1000, 500,-1000> color White}

// p0: Origin position of the lower cylinder
// p1: Upper position of the lower cylinder
// L: recursion level (WARNING: after 5 or 6 a big pc needed)
// d: Rayon of the lower cylinder

#macro arbre(p0,p1,L,d)
 #local nd=d-(d*0.5);

 cylinder{p0,p1,nd}
 sphere{p1,nd}

 #local ang=VAngle(p0,p1);
 #local Np0=vrotate(p1,ang);
 #local Np1=Np0+< rand(Ra)/3,rand(Ra)/2, rand(Ra)/3>*3;
 #local Np2=Np0+<-rand(Ra)/3,rand(Ra)/2,-rand(Ra)/3>*3;
 #local Np3=Np0+< rand(Ra)/3,rand(Ra)/2,-rand(Ra)/3>*3;
 #local Np4=Np0+<-rand(Ra)/3,rand(Ra)/2, rand(Ra)/3>*3;

 cylinder{Np0,Np1,nd/2}
 cylinder{Np0,Np2,nd/2}
 cylinder{Np0,Np3,nd/2}
 cylinder{Np0,Np4,nd/2}

 sphere{Np1,nd/2}
 sphere{Np2,nd/2}
 sphere{Np3,nd/2}
 sphere{Np4,nd/2}


 #if(L>0)
 #local NL=L-1;

 arbre(Np0,Np1,NL,nd)
 arbre(Np0,Np2,NL,nd)
 arbre(Np0,Np3,NL,nd)
 arbre(Np0,Np4,NL,nd)

 #end
#end
#declare r=seed(0);
#declare a=0;
#while(a<4)
#declare b=0;
#while (b<4)
#declare Ra=seed(RRand(100,500,r));
union{
arbre(<0,0,0>,<RRand(-0.2,0.2,r),RRand(0.3,1.5,r),RRand(-0.2,0.2,r)>,3,0.3)
translate<RRand(3,8,int(Ra))*a,0,RRand(6,8,int(Ra))*b>
}
#declare b=b+1;
#end
#declare a=a+1;
#end


plane{y,0 pigment{rgb<0.5,0.9,0.4>}}

sky_sphere {
  pigment {
    gradient y
    color_map { [0.0 color rgb <0.7,0.7,1.0>] [1.0 color blue 0.5] }
  }
}


Post a reply to this message


Attachments:
Download 'arbre.png' (210 KB)

Preview of image 'arbre.png'
arbre.png


 

From: Andrew the Orchid
Subject: Re: my first tree
Date: 20 Oct 2004 15:30:26
Message: <4176bcd2$1@news.povray.org>
As tree macros go, that's actually not bad...

The trees are pretty clearly made out of straight cylinders (although 
with rounded ends). On the other hand, the trees have a good "volume", 
which gives them a nice lifelike quality.

Keep it up. ;-)

Andrew.


Post a reply to this message

From: scott
Subject: Re: my first tree
Date: 20 Oct 2004 16:28:27
Message: <4176ca6b@news.povray.org>
"sap" <nospam@please> wrote in message news:4176b727@news.povray.org
> After a lot of try, i realesed a recursive
> macro for make trees, just want to share it :)

The top half of the trees look really good.  But on the lower half it is 
obvious they are made from cylinders and spheres not joined particularly 
well ;-)  It's an excellent first try though!

Perhaps you could use blobs for the first two levels, to smooth out the 
joins.  And apply some bark texture.


Post a reply to this message

From: Renderdog
Subject: Re: my first tree
Date: 20 Oct 2004 17:20:00
Message: <web.4176d5fcdc74196fb8a63dd50@news.povray.org>
"scott" <spa### [at] spamcom> wrote:
> The top half of the trees look really good.  But on the lower half it is
> obvious they are made from cylinders and spheres not joined particularly
> well ;-)  It's an excellent first try though!
>
> Perhaps you could use blobs for the first two levels, to smooth out the
> joins.  And apply some bark texture.

Or just remove the first two levels and you'd have some pretty
good bushes.


Post a reply to this message

From: Sap
Subject: Re: my first tree
Date: 21 Oct 2004 02:50:43
Message: <41775c43@news.povray.org>
Thanks for all your comments.

I try now to add leafs on my tree (dont know how to do for the moment),
perhaps a new version in the future.
I dont want to use triangles, too difficult for me, does disc conveined for
the leafs ("feuille" en francais je suis pas sur du mot en anglais)?


Post a reply to this message

From: Marc Jacquier
Subject: Re: my first tree
Date: 21 Oct 2004 03:13:51
Message: <417761af@news.povray.org>

41775c43@news.povray.org...
> Thanks for all your comments.
>
> the leafs ("feuille" en francais je suis pas sur du mot en anglais)?
>


Yes one leaf, several leaves :)

Good trees as the others said , I like the general volume.
If you don't want to deal with triangles you can try sphere_sweeps or
splines for the two 1sts levels to get them less straight

Marc


Post a reply to this message

From: andrel
Subject: Re: my first tree
Date: 21 Oct 2004 16:33:51
Message: <41781CA9.1040301@hotmail.com>
Sap wrote:
> Thanks for all your comments.
> 
> I try now to add leafs on my tree (dont know how to do for the moment),
> perhaps a new version in the future.
> I dont want to use triangles, too difficult for me, does disc conveined for
> the leafs ("feuille" en francais je suis pas sur du mot en anglais)?
> 
> 
Not sure what the French "feuille" means (and babel fish is no help
here) but possibly you are looking for "canopy".


Post a reply to this message

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