// CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare tx_verde = texture{ pigment{ color rgb < 0.00, 1.00, 0.00 > } } // DESCRIÇÃO DA CENA #declare fino = 0.100; #declare grosso = 0.250; // Partes da cena: #declare chao = box{ <-20,-20,-1>, <+20,+20,0> } #macro arvore(N, R) #local P = 0; union{ cylinder{ <0.00 , 0.00, 0.00>, <0.00 , 0.00, 2.00>, grosso texture{ tx_plastico } } object {galhos (N, P, R, 0.00, 2.00)} } #end #macro galhos(N, P, R, Y, Z) #if (N = 0) box{ < 0.00, Y, Z >, < 0.00, Y+0.100, Z+0.100 > texture{ tx_verde } } #else union{ cylinder{ <0.00 , Y, Z>, <0.00 , Y, Z + 1>, fino/R texture{ tx_plastico } } object{ galhos(N - 1, P + 1, R*2, Y, Z+1)} cylinder{ <0.00 , Y, Z>, <0.00 , Y + 1, Z>, fino/R texture{ tx_plastico } } object{ galhos(N - 1, P + 1, R*2, Y + 1, Z) rotate <-90, 0, 0> translate <0, Y-1, Z+1> } cylinder{ <0.00 , Y, Z>, <0.00 , Y - 1, Z>, fino/R texture{ tx_plastico } } object{ galhos(N - 1, P + 1, R*2, Y - 1, Z) rotate <90, 0, 0> translate <0, Y+1, Z+1> } // cylinder{ // <0.00 , Y, Z>, // <0.00 , Y, Z - 1>, // fino/R // } // object{ galhos(N - 1, R*2, Y, Z - 1)} } #end #end #include "eixos.inc" // Aqui está a cena, finalmente: union{ object{ eixos(3.00) } object{ chao translate < 0,0,-5 > texture{ tx_xadrez } } object{ arvore(2,1) } } #include "camlight.inc" #declare centro_cena = < 0.00, 3.00, 2.00 >; #declare raio_cena = 6.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 16.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)