//========================================= // Leaf & Tree examples for the MakeTree macro // (c) 1999 Gilles Tran tran@inapg.inra.fr //========================================= // High tree example //----------------------------------------- // This file calls the MakeTree and MakeLeaf macros // and defines the textures and parameters // Set the [dofile] parameter to "true" // when you want to create the final file //----------------------------------------- #include "colors.inc" #include "skies.inc" //#include "stones.inc" #include "txttree.inc" #include "maketree.pov" // tree & leaf macro /*#include "MyBush.pov" #include "MyBusha.pov" #include "MyBushb.pov" #include "MyBushc.pov" #include "MyBushd.pov" #include "MyPlant.pov" #include "MyPlanta.pov" #include "MyPlantb.pov" #include "MyPlantc.pov" #include "MyPlantd.pov" #include "MyPlante.pov" #include "MyHTree.pov" #include "MyHTreea.pov"*/ //========================================= // Camera & light //----------------------------------------- #declare PdV=<0, 4 , -65>; #declare PdA=<0,16,0>; camera {location PdV direction <0.0 , 0.0 , 1.7 > up y*1 //right <1.85,0,0> right <1.33,0,0> look_at PdA} //----------------------------------------- light_source{PdV color White*0.5 shadowless} light_source{<130,50,-200> color rgb<1.0,0.65,0.35>*4.5} //========================================= // Tree macro Parameters //----------------------------------------- // These parameters must be declared before calling the tree macro //----------------------------------------- #declare dofile=true; // true creates a tree file ; false otherwise #declare dotexture=true; // true creates a textured tree (with the texture following the branch); false otherwise #declare ftname="gttree6.inc" // file name for tree #declare fvname="gtfoliage6.inc" // file name for foliage #declare ffname="gtleaf6.inc" // file name for leaf #declare txtTree=texture{txtTree_2} // Bark texture //----------------------------------------- // Random streams // one stream for branches and another one for leaves // so that the leafed tree has the same structure as the leafless one //----------------------------------------- //#declare rsd=1531; // random seed #declare rsd=1532; // random seed //#declare rsd=1533; // random seed #declare rd=seed(rsd); // random stream for branches #declare rdl=seed(rsd); // separate random stream for leaves //----------------------------------------- // Tree structure parameters // test with low level0 and nseg0 (3 or 4) // High (>=6) recursion levels [level0] gives more complex trees // High (>=6) segment numbers [nseg0] gives smoother trees //----------------------------------------- #declare level0=6; // recursion level //#declare level0=2; // recursion level #declare nseg0=8; // initial number of branch segments (decreases of one at each level) #declare nb=3; // max number of branches per level #declare dotop=true; // if true, generates an extra branch on top of trunk (sometimes necessary to give more verticality) #declare lb0=8; // initial branch length #declare rb0=1.0; // initial branch radius #declare ab0=45; // initial branch angle (x angle between the trunk and the first branch) #declare qlb=0.80; // branch length decrease ratio (1=constant length) #declare qrb=0.59; // branch radius decrease ratio (1=constant radius) #declare qab=0.9; // branch angle decrease ratio (1=constant angle) #declare stdax=10; // stdev of x angle (angle x = ax+(0.5-rand)*stdax) #declare stday=30; // stdev of y angle (angle y = ay+(0.5-rand)*stday) #declare branchproba=1; // probability of branch apparition #declare jb=0.6; // secondary branches start after this ratio of branch length #declare fgnarl=0.35; // gnarledness factor - keep it low <0.8 #declare stdlseg=0.5; // stddev of branch segment length (0...1) (adds more randomness to branch length) #declare twigproba=0.75; // probability to have a twig on a trunk segment #declare v0=<0,1,0>; // initial direction - change to give an initial orientation #declare pos0=<0,0,0>; // initial trunk position (no need to change this one) //----------------------------------------- // constraints parameters //----------------------------------------- #declare vpush=<0,0.05,0>;// direction of push (wind, gravity...) <0,-1,0> = gravity ; <0,1,0> = antigravity #declare fpush=0.2; // force of push #declare aboveground=0; // constrains the branches above this level #declare belowsky=140; // constrains the branches below this level //----------------------------------------- // root parameters //----------------------------------------- #declare rootproba=1; // probability of root 0=no root ; 1=all [nb] roots #declare nroot=nb+2; // number of roots; #declare vroot=<1,-0.2,0>; // initial direction of root #declare yroot=<0,0.5,0>; // initial position of root above ground //----------------------------------------- // leaf position parameters //----------------------------------------- #declare leafproba=0.85; // probability of leaf 0=no leaf ; 1=leaf on each segment #declare leaflevel=3; // level where the leaves start to appear #declare alz0=110; // max z angle for leaf #declare alx0=-10; // start x angle for leaf #declare stdalx=40; // std x angle for leaf #declare stdlsize=0.3; // stddev of leaf size 0=constant size; size = leafsize*(1+stdlsize*rand) //----------------------------------------- // leaf structure parameters //----------------------------------------- #declare txtLeaf=texture{txtLeaf_3} // Leaf texture #declare lsize=0.18; // leaf size #declare seg=10; // nb of leaf segments and stalk segments : increase to smooth #declare ll=7; // leaf length #declare wl=1.25; // leaf width #declare fl=0.5; // depth of leaf fold #declare lpow=0; // modifies the leaf shape : lpow=3 makes heart-shaped leaf #declare al=100; // leaf bending angle : the leaf bends backward until this angle #declare apow=1; // curve power, how slow the leaf bends #declare ndents=0; // dents in the leaf (8 = "oak" leaf). May require a high seg >20 #declare nlobes=3; // number of lobes (individual leaves) #declare alobes=110; // angle made by all the lobes #declare qlobes=0.7; // size of the farest lobe (0.9 = size will be 0.9*leaf length) #declare ls=3; // stalk length (0=no stalk) #declare ws=0.12; // width of stalk #declare as=10; // stalk bending angle : the stalk bends forward //----------------------------------------- // end of parameters //========================================= //========================================= // Make the tree now ! //----------------------------------------- object{ #if (leafproba>0) #declare Leaf=object{MakeLeaf(lsize,seg,ll,wl,fl,lpow,al,apow, ndents,nlobes,alobes,qlobes,ls,ws,as,dofile,ffname) #if (dotexture=false) // no texture applied to tree segments, so the leaf texture must be used for the individual leaf texture{txtLeaf} #end } #end MakeTree() #if (dotexture = true) // texture is already applied to tree so that we can safely apply the leaf texture to the leaves texture {txtLeaf} #else texture {txtTree} // apply tree texture regardless of the tree structure #end } /* blob{ sphere {<0,0,0>,2,1} sphere {<0,1.5,0>,2,1} sphere {<0.5,1.0,-0.2>,2,0.93} sphere {<1.0,-0.3,0>,1.3,1} sphere {<-1.0,-0.02,0>,1.5,0.95} sphere {<1.95,-0.65,0>,1.2,0.97} threshold 0.65 scale <1,1,0.90> texture {T_Stone13 normal{bumps 0.5 scale 0.1} } finish{specular 0.1 roughness 0.2} rotate <85,20,10> clipped_by {plane{y,0} rotate x*180} translate<-6,-0.51,-23> } */ plane{y,0 pigment{rgb<1,0.7,0.3>}} sky_sphere {pigment{P_Cloud1 scale<0.65,0.94,0.37>}} /* fog { distance 220 color rgbf<0.3, 0.5, 0.2, 1.0> fog_type 2 fog_offset 25 fog_alt 1 } */