// TWIGS / Left Twigs '07.11 // by Tsutomu HIGO URL:http://www.asahi-net.or.jp/~nj2t-hg/ #version 3.6; global_settings { assumed_gamma 2.2 } light_source {<1500, 1000, -3000> color <1, 1, 1>} camera { location <0, -70, -80> angle 65 look_at <-1, 10, 0> } #macro Dla15 (Nmax, Rds) #declare R1 = seed(8); #declare Cp = array[Nmax][5] #declare Cp[0][0] = 0; // x of sphere's center #declare Cp[0][1] = 0; // z of sphere's center #declare Cp[0][2] = -100/(0+2); // y of sphere's center #declare Cp[0][3] = 0; // Distanse of sphere's center #declare Cp[0][4] = 2*pi*rand(R1); // Angle of sphere's center sphere { Rds pigment {color rgb <0.6+0.4*0/Nmax, 0.6-0/Nmax*0.6, 0.2>} finish { reflection 0.1 phong 2 brilliance 1 ambient 0.7 } no_shadow } #declare Np = 1; #while (Np < Nmax) #declare Cp[Np][4] = 2*pi*rand(R1); #if (Np = 1) #declare Cp[Np][3] = 2; #declare Cp[Np][0] = Cp[Np][3]*cos(Cp[Np][4]); #declare Cp[Np][1] = Cp[Np][3]*sin(Cp[Np][4]); #declare Cp[Np][2] = -100/(Np/100+2); #declare Nsclose = 0; #else #declare Ns = Np-1; #while (Ns > 0) #declare Det = 0; #declare Adis = abs(Cp[Np][4]-Cp[Ns][4]); #if (Adis > pi) #declare Adis = 2*pi-Adis; #end #if (Cp[Ns][3]*sin(Adis/2) < 0.6) #declare Cp[Np][3] = Cp[Ns][3]*cos(Adis)+2*sin(acos(Cp[Ns][3]*sin(Adis)/2)); #declare Cp[Np][0] = Cp[Np][3]*cos(Cp[Np][4]); #declare Cp[Np][1] = Cp[Np][3]*sin(Cp[Np][4]); #declare Cp[Np][2] = -100/(Np/100+2); #declare Nsclose = Ns; #declare Det = 1; #declare Ns = 1; #end #declare Ns = Ns-1; #end #if (Det = 0) #declare Cp[Np][3] = 2; #declare Cp[Np][0] = Cp[Np][3]*cos(Cp[Np][4]); #declare Cp[Np][1] = Cp[Np][3]*sin(Cp[Np][4]); #declare Cp[Np][2] = -100/(Np/100+2); #declare Nsclose = 0; #end #end union { sphere { Rds*(1-Np/Nmax+0.1)} cylinder { Rds*(1-Np/Nmax+0.1)} pigment {color rgb <0.6, 0.4, 0.2>} finish { reflection 0.1 phong 0.22 brilliance 0.1 ambient 0.3 } } #declare Np = Np+1; #end #end Dla15 (4000, 0.4) sky_sphere { pigment { gradient y color_map {[0.0 color rgb <1, 1, 1>] [1.0 color rgb <0.4, 0.7, 1.0>]} } }