// CELLULAR AUTOMATON 2 / Like a Tree '08.06 // by Tsutomu HIGO URL>>> http://www.asahi-net.or.jp/~nj2t-hg/ #version 3.6; global_settings { assumed_gamma 2.2 max_trace_level 5 } light_source {<-300, 1000, -380> color <1, 0.7, 0.3>} camera { location <0, 50, -50> angle 64 look_at <-5, -7, 0> } #declare Nmax = 10; //24 #declare Cp = array[2*Nmax][2][2*Nmax]; #declare Nx = 0; #while (Nx < 2*Nmax) #declare Nz = 0; #while (Nz < 2*Nmax) #declare Cp[Nx][0][Nz] = 0; #declare Nz = Nz+1; #end #declare Nx = Nx+1; #end #declare Cp[Nmax][0][Nmax] = 1; blob { threshold 0.3 #declare Ny = 1; #while ( Ny < 2*Nmax ) #declare Nx = 0; #while ( Nx < 2*Nmax ) #declare Nz = 0; #while ( Nz < 2*Nmax ) #declare Cp[Nx][1][Nz] = mod(Cp[mod(Nx-1+2*Nmax,2*Nmax)][0][Nz] +Cp[mod(Nx+1, 2*Nmax)][0][Nz] +Cp[Nx][0][mod(Nz-1+2*Nmax,2*Nmax)] +Cp[Nx][0][mod(Nz+1, 2*Nmax)],6); #switch (Cp[Nx][1][Nz]) #case (0) #declare Cp[Nx][1][Nz] = 2; #break #case (1) #declare Cp[Nx][1][Nz] = 1; #break #case (2) #declare Cp[Nx][1][Nz] = 0; #break #case (3) #declare Cp[Nx][1][Nz] = 0; #break #case (4) #declare Cp[Nx][1][Nz] = 1; #break #case (5) #declare Cp[Nx][1][Nz] = 0; #break #end #if( Cp[Nx][1][Nz] = 1 ) sphere {, 1.5,0.3} #end #if( Cp[Nx][1][Nz] = 2 ) sphere {, 0.7,0.15} #end #declare Nz = Nz+1; #end #declare Nx = Nx+1; #end #declare Nx = 0; #while (Nx < 2*Nmax) #declare Nz = 0; #while (Nz < 2*Nmax) #declare Cp[Nx][0][Nz] = Cp[Nx][1][Nz]; #declare Nz = Nz+1; #end #declare Nx = Nx+1; #end #declare Ny = Ny+1; #end pigment {color rgbt <0, 1, 0.2, 0.8>} finish { reflection 0.9 phong 1 brilliance 1 ambient 0.2 } no_shadow rotate z*-40 } background {color rgb <0, 0, 0.2>}