POV-Ray : Newsgroups : povray.binaries.images : Glowing tree #2 - tree.jpg (1/1) : Re: Glowing tree #2 - tree.jpg (1/1) Server Time
4 Nov 2024 13:02:04 EST (-0500)
  Re: Glowing tree #2 - tree.jpg (1/1)  
From: Chris Huff
Date: 10 Sep 2000 07:37:35
Message: <chrishuff-13863F.06392410092000@news.povray.org>
In article <39BB1B87.CF062997@yahoo.com>, ryan constantine 
<rco### [at] yahoocom> wrote:

> no, no ,no.  you said you had to change the tree algorithm.  what
> algorithm or tree inc/macro are you using?  i didn't mean what species
> of deciduous tree!<g>

Oh... :-)
I am not using any include, and I don't think the algorithm has a name, 
it is a simple recursive macro which branches a random number of times 
at each node, and adjusts trunk radius and branch length depending on 
recursion depth. It is made entirely of cones, so if it was well lit, 
you could probably easily see gaps where the branches bend.(If I was 
after a more realistic macro, I would have put spheres at the junctions 
and not used perfectly straight branches, but this macro was designed 
specially for this scene.)
Here is the relevant code for the macro:

#macro SRand(RS) (rand(RS)*2 - 1) #end

#declare TreeTex =
texture {
    pigment {color White}
    finish {
        diffuse 1 ambient 0
        metallic reflect_metallic
    }
}

#declare RsA = seed(48664);
#declare RadScl = 0.75;
#declare LenScl = 0.98;

#macro Rec(Pt, Dir, Rad, Lvl)
    #if(Lvl>0)
        cone {Pt, Rad, Pt+Dir, Rad*RadScl texture {TreeTex}}
        #local J = 0;
        #local N = rand(RsA)*4;
        #while(J<N)
            #if(rand(RsA)<0.9)
                Rec(Pt+Dir, vrotate(Dir, x*SRand(RsA)*45 +
                                         z*SRand(RsA)*45)*LenScl,
                                         Rad*RadScl, Lvl-1)
            #end
            #set J = J + 1;
        #end
    #else
        cone {Pt, Rad, Pt+Dir*0.99, 0 texture {TreeTex}}
    #end
#end

union {
    Rec(< 0, 0, 0>, y*0.5, 0.15, 8)
}

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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