#version unofficial MegaPov 0.5; background{color rgb 1} light_source{<200, 200, 200> color rgb<1, 1, 1>} light_source{<-10, 8, 100> color rgb<1, 1, 1>} camera{location<0, 0, 50> sky<0, 0, 1> right<-4/3, 0, 0> angle 50 look_at<0, 0, 0>} //X,Y,Z - initial sphere positions //R - initial radius //L - recursion level //Next - incrementer for sphere position while loop, higher the Next, longer the sphere_sweep #macro Tree_Root(X,Y,Z,R,L,Next) #declare counter=0; sphere_sweep { linear_sphere_sweep, 10, #while(Next>0) ,R #declare R=R/1.05; #local X=X-rand(Rand01); #local Y=Y-rand(Rand01); #local Z=Z-rand(Rand01); #declare Next=Next-1; #declare counter=counter+1; #end } #if(L>0) #local New_L = L-1; #local New_R=R; #local PX=X; #local PY=Y; #local PZ=Z; #local Co=1;#local Co=Co/L; union{ union{ Tree_Root(X,Y,Z,New_R,New_L,10) // first works translate<-PX,-PY,-PZ> rotate 35/L*z translate } union{ Tree_Root(X,Y,Z,New_R,New_L,10) // secone doesn't work translate<-PX,-PY,-PZ> rotate -35/L*z translate } pigment{rgb} } #end #end union{ Tree_Root(0,0,0,2,2,10) pigment{color rgb <1,1,0>} }