// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2021-12-09 08:17:39 by stolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb 0.5*< 0.2, 0.4, 1.0 > } #declare tx_dirt = texture{ pigment{ color rgb < 0.2, 0.2, 0.2 > } finish{ diffuse 0.8 reflection 0.25 ambient 0.1 specular 0.5 roughness 0.1} } #declare tx_trunk = texture{ pigment{ color rgb < 0.7, 0.4, 0.2 > } finish{ diffuse 0.8 reflection 0.25 ambient 0.1 specular 0.5 roughness 0.1} } #declare tx_leaf = texture{ pigment{ color rgb < 0.2, 1, 0.2 > } finish{ diffuse 0.8 reflection 0.25 ambient 0.1 specular 0.5 roughness 0.1} } #declare tx_ground = texture{ pigment{ color rgb < 0.3, 1.0, 0.2 > } finish{ diffuse 0.8 specular 0.5 roughness 0.1} } // ====================================================================== // DESCRICAO DA CENA #declare roleta = seed(10); #declare tree_lvls = 10; #declare leaf = disc { <0, 0, 0>, <0, 1, 0> ,1 texture{ tx_leaf} } #declare ground = box{ <-400,-400,-1>, <+400,+400,0> texture{ tx_ground } } #macro spawn_branch(length, thick, base_x, base_y, base_z, branch_lvl) #if (branch_lvl >= tree_lvls) // rotations #local x_rot = rand(roleta); #local y_rot = rand(roleta); #local z_rot = rand(roleta); // spawn leaf object{leaf translate rotate} #else #local sub_brach_lvl = branch_lvl - 1; // spawn branches #local sub_branch_length = (2*length)/3; #local sub_branch_thick = (2*thick)/3; #local sub_branch_x = base_x; #local sub_branch_y = base_y; #local sub_branch_z = base_z + length; #local sub_branch_lvl = branch_lvl + 1; // rotations #local x_rot = rand(roleta)*45; #local y_rot = rand(roleta)*45; #local z_rot = rand(roleta)*45; object{ union{ difference { object{ sphere{ , thick * 1.5 texture{ tx_trunk } } } object{ cone { , thick * 1.5 // Center and radius of one end , thick // Center and radius of other end texture { tx_trunk} } } } object{ cone { , thick * 1.5 // Center and radius of one end , thick // Center and radius of other end texture { tx_trunk} } } object{ cylinder { , , thick texture { tx_trunk} } } } rotate } spawn_branch(sub_branch_length, sub_branch_thick, sub_branch_x, sub_branch_y, sub_branch_z, sub_branch_lvl) spawn_branch(sub_branch_length, sub_branch_thick, sub_branch_x, sub_branch_y, sub_branch_z, sub_branch_lvl) #end #end #include "eixos.inc" // object{ eixos(10) } // Aqui est� a cena, finalmente: union{ object{ground} spawn_branch(10, 1, 0, 0, 0, 0) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 15.00 >; #declare raio_cena = 35; #declare dir_camera = < 20.00, 7.00, 2.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)