global_settings { assumed_gamma 1 //radiosity{normal on} } #include "math.inc" #include"SunPos.inc" #declare ShowSeeds=on; #declare ShowPetals=on; #declare ShowStem=on; #declare ShowLeaves=off; /////////////////////////////////////////////////////////////// #declare MaxPetals=21; // 14 minimum #declare Radius = .12; // radius of seed group #declare PetalSize=<.4,1,1>*.08; #declare StemThickness=.02; #declare StemHeight=1; #if (StemHeight)*MaxTrans) #end // // light_source { // SunPos(Year, Month, Day, Hour, Minute, Lstm, LAT, LONG) // rgb 1 // } #declare SunPosition= SunPos(2008, 2, 23, 15/*Hour*/, 00, 0, -25, 28); #declare SunAngle=<-Al,Az,0> ; light_source { SolarPosition rgb <1.2,1.1,1> } // set a color of the background (sky) background { color rgb <0.1, 0.3, 0.8> } plane { y, 0 pigment{rgb<.5,.4,.1>}} ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// seeds using Alf Peak's Fibonacci code //////////////////////////////////////////// #declare phi= (sqrt(5)-1)/2; #declare Inc = phi*360; // First component's offset to avoid a messy center. #declare Offset=0.5; // May also prevent a div_by_zero error #declare MaxCount=1000; #declare Count=0; #if(ShowSeeds) #declare Seeds= union{ #while (Count rotate <90,45,0> scale <.5+(Rad/10),1+(Rad*Rad),.5+(Rad/10)>*0.1 pigment{ rgb *.3} } box{-.5,.5 rotate <90,45,0> scale <1,40,1>*0.1 translate y*.2 pigment {colour rgb<.5,.2,0>*.1} } } superellipsoid{<.5,.5> rotate <90,0,0> scale <.3,1+(1.3*Rad*Rad),.3>*0.1 pigment{ rgb <1,.5,0>} } rotate <-2*rand(Rnd),rand(Rnd),0>*10 } superellipsoid{<.5,1> rotate <90,45,0> scale <.7,5,.7>*0.1 pigment {rgb <.001,.01,0>} } rotate x*Rad*20 translate z*Rad rotate y*Count*Inc } #declare Count=Count+1; #end //rotate x*180 scale Radius*(.3/.75) //.3 } //object {Seeds} #end// ShowSeeds /////////////////////////////////////////////////////////// /// petals //////////////////////////////////////////////// #if (ShowPetals) #declare PetalCount=0; #declare Petals=union{ #while (PetalCount ; #declare GraVect=<0,-.3,-.2>; #declare Point=<-.5,1,-1>+vrotate(GraVect,-Rot)+; // #declare BackPoint=<0,1,0>+vrotate(<0, .5, 0>,<(90*rand(Rnd)),.5-rand(Rnd),5-(10*rand(Rnd))>) ; #declare LeafPoint=<0,.3,1>+vrotate(<0, .5, .5>,<(90*rand(Rnd)),.5-rand(Rnd),5-(10*rand(Rnd))>) ; bicubic_patch { // flower leaves type 1 flatness 0 u_steps 5 v_steps 5 LeafPoint (LeafPoint*.7)+(<.8, .8, 0>*.3)+<.3,.3,1>* Rz(R,.1,<2, .3, -.5>) <.5, -.1, .2> (LeafPoint*.7)+(<.8, .8, 0>*.3)+<.3,.3,1>* Rz(R,.1,<0, 0, 0>) Rz(R,.1,<1, .6, .5>) <0, -.2, 1> Rz(R,.1,<-2,.3,-.5>) Rz(R,.1,<-1, .6, .5>) Rz(R,.1,<0, 0, 0>) <.7, -.1, .2> <-.5,-.1,.2> <0,-2, 1> <-.7,-.1, .2> <0, 0, .2> normal{wrinkles scale <.1,1,.3> // pattern modifier warp {black_hole LeafPoint, 1 strength 10 } } pigment{colour rgb <.01,.3,0>} // finish{ambient 0 diffuse 1} translate (.3*(.5-)) scale PetalSize*<1,.5,1> translate <0,Radius,.05> rotate z*(Rot.z ) } bicubic_patch { // Rear petals type 1 flatness 0 u_steps 5 v_steps 5 BackPoint (BackPoint*.7)+(<.8, .8, 0>*.3)+<.3,.3,1>* Rz(R,.1,<2, .3, -.5>) <.5, -.1, .2> (BackPoint*.7)+(<.8, .8, 0>*.3)+<.3,.3,1>* Rz(R,.1,<0, 0, 0>) Rz(R,.1,<1, .6, .5>) <0, -.2, 1> Rz(R,.1,<-2,.3,-.5>) Rz(R,.1,<-1, .6, .5>) Rz(R,.1,<0, 0, 0>) <.7, -.1, .2> <-.5,-.1,.2> <0,-.2, 1> <-.7,-.1, .2> <0, 0, .2> normal{wrinkles scale <.1,1,.3> // pattern modifier warp {black_hole BackPoint, 1 strength 10 } } pigment{colour rgb <1,.5,0>} // finish{diffuse 1} translate (.3*(.5-)) scale PetalSize*<1.5,.8,1> translate y*Radius rotate z*(Rot.z +.5) } bicubic_patch { // Front Petals type 1 flatness 0 u_steps 5 v_steps 5 Point (Point*.7)+(<.3, .8, .3>*.3)+<.3,.3,.5>* Rz(R,.1,<2, .3, -1.5>) <.5, -.4, -.2> (Point*.7)+(<-.3, .8, .3>*.3)+<-.3,.4,.5>* Rz(R,.1,<0, 0, 0>) Rz(R,.1,<1, .6, -1.5>) <0, 0, 0> Rz(R,.1,<-2,.3,0>) Rz(R,.1,<-1, .6, -.5>) Rz(R,.1,<0, 0, 0>) <.7, -.4, -.2> <-.5,-.4,-.1> <0,.1,0> <-.7,-.4, -.2> <0, -.4, -.2> normal{wrinkles translate scale <.1,.3,.3> warp {black_hole Point , 1 strength 10 } } pigment{colour rgb <1,.5,0>} finish{diffuse 1} translate (.3*(.5-)) scale PetalSize translate <0,Radius,-.05> rotate z*Rot.z } #declare PetalCount=PetalCount + 1; #end rotate z*180 rotate x*-90 }// object{Petals} #end// ShowPetals /////////////////////////////////////////////////// #if(ShowStem) #declare Stem=difference{ sphere_sweep { cubic_spline //b_spline // alternative spline curves 8, // number of specified sphere positions <0, -1, 0>, StemThickness*2 // position, radius <0, 0, 0>, StemThickness // ... < 0, (StemHeight/2)-Radius, 0>, StemThickness *.9 < 0, (StemHeight/2)-(Radius/2), 0>, StemThickness *.7 < 0, (StemHeight-Radius)*.8, 0>, StemThickness *.7 <0,StemHeight,0>+(vrotate(<0,-Radius,0>, <90-Al,Az,0> )),StemThickness+(Radius*.2) <0, StemHeight,0>, Radius <0, StemHeight,0>, StemThickness } sphere{0,Radius scale <1.2,1,1.2> translate<0,.1,0> rotate <90-Al,Az,0> translate<0,StemHeight,0> pigment{rgb <0,.001,0>}finish{ambient 0}} pigment{colour rgb <0,.2,0>} finish{ambient 0 roughness .1 diffuse .8 brilliance .5} } #end// ShowStem ///////////////////////////////////////////////////////////////// //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #if (ShowSeeds) object {Seeds rotate -x*90 rotate <-Al,Az,0> translate y*StemHeight} #end #if (ShowPetals) object {Petals rotate -x*90 rotate <-Al,Az,0> translate y*StemHeight} #end #if (ShowStem) object{Stem} #end camera { location <-.9, 1.5,0> // <1, 1.5,0> // final look_at <0.0, StemHeight-Radius, 0.0> right x*image_width/image_height }