// Hans-Jakob Schwer // povray 3.6 scenefile // a 3d-fractal consisting of boxes //#include "colors.pov" #include "colors.inc" #include "textures.inc" #include "shapes.inc" #include "metals.inc" #include "glass.inc" #include "woods.inc" // global settings and objects global_settings {max_trace_level 12} camera { location <-16.2, 16, +15> look_at <0,0,0> } #declare Dist=80.0; // light distance // lights light_source {< 0, 0, 0> color Red fade_distance Dist fade_power 2 } light_source {< -50, 55, -50> color Orange fade_distance Dist fade_power 2 } light_source {< 50, 50, -43> color White fade_distance Dist fade_power 2 } light_source {< -15, -30, 40> color Blue fade_distance Dist fade_power 2 } // color map for the floor-texture #declare M_Wood18B = colour_map { [0.00 0.25 color rgbf < 0.30, 0.46, 0.42, 0.10> color rgbf < 0.34, 0.49, 0.43, 0.20>] [0.25 0.40 color rgbf < 0.34, 0.39, 0.33, 0.20> color rgbf < 0.35, 0.48, 0.40, 0.70>] [0.40 0.50 color rgbf < 0.00, 0.38, 0.40, 0.70> color rgbf < 0.30, 0.43, 0.35, 0.95>] [0.50 0.70 color rgbf < 0.30, 0.43, 0.35, 0.95> color rgbf < 0.36, 0.39, 0.47, 0.70>] [0.70 0.98 color rgbf < 0.36, 0.39, 0.87, 0.70> color rgbf < 0.00, 0.29, 0.33, 0.20>] [0.98 1.00 color rgbf < 0.00, 0.00, 1.00, 1.00> color rgbf < 0.0, 0.0, 0.0, 0.70>] } // floor-Texture #declare Floor_Texture = texture { pigment { P_WoodGrain18A color_map { M_Wood18A }}} texture { pigment { P_WoodGrain12A color_map { M_Wood18B }}} texture { pigment { P_WoodGrain12B color_map { M_Wood18B }} finish { reflection 0.25 } } #declare Floor = plane { y,0 texture { pigment { crackle scale 1.5 turbulence 0.6 color_map { M_Wood18B } // end of color_map scale 2.0 } // end of pigment finish { diffuse 0.2 phong 0.3 } scale 1.1 rotate y*90 rotate <10, 0, 15> translate <0, -5, 0> } // end of texture ----------------------- translate <0, -10, 0> } // the main function, generating the boxes #macro rek2(stufe, x_, y_, z_, x2_, y2_, z2_,ori) object { #if(stufe > 2) // uses wood-texture instead of glass for speed reasons in recursion-level > 2 difference { box // solid box with floor-texture { , texture{ Floor_Texture } } sphere // big sphere, divided from any object { <0,0,0>, 4.5 texture{ Rusty_Iron } } } #else difference { box // glass box with texture { , texture{ T_Glass2 } interior {I_Glass caustics 1} } sphere // big sphere, divided from any object { <0,0,0>, 4.5 texture{ Rusty_Iron } } } #end } // end object // the recursive part, the boxes are placed by some simple // rules with the help of the modulo-Operator (mod(n)) // the orientation of the boxes is given by ori #if(stufe > 0) #local dx = x2_ - x_; #local dy = y2_ - y_; #local dz = z2_ - z_; #local dxv = dx * 0.1; #local dyv = dy * 0.1; #local dzv = dz * 0.1; #if(ori = 0) rek2(stufe-1, x_+dxv, y_-dy, z_+dzv, x2_-dxv, y2_-dy, z2_-dzv,0) #if(mod(stufe,7) = 0) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,2) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,3) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,4) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,5) #end #end #if(ori = 1) rek2(stufe-1, x_+dxv, y_+dy, z_+dzv, x2_-dxv, y2_+dy, z2_-dzv,1) #if(mod(stufe,7) = 0) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,2) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,3) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,4) rek2(stufe-3,x_,y_,z_,x2_,y2_,z2_,5) #end #end #if(ori = 2) rek2(stufe-1, x_+dx, y_+dyv, z_+dzv, x2_+dx, y2_-dyv, z2_-dzv,2) #if(mod(stufe,5) = 0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,1) #end #end #if(ori = 3) rek2(stufe-1, x_-dx, y_+dyv, z_+dzv, x2_-dx, y2_-dyv, z2_-dzv,3) #if(mod(stufe,5) = 0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,1) #end #end #if(ori = 4) rek2(stufe-1, x_+dxv, y_+dyv, z_+dz, x2_-dxv, y2_-dyv, z2_+dz,4) #if(mod(stufe,4) = 0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,1) #end #end #if(ori = 5) rek2(stufe-1, x_+dxv, y_+dyv, z_-dz, x2_-dxv, y2_-dyv, z2_-dz,5) #if(mod(stufe,4) = 0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,0) rek2(stufe,x_,y_,z_,x2_,y2_,z2_,1) #end #end #end #end // outer object object { #union { #local tt = 27; #local h = 1; #local j = 0.4; #local k = 1; rek2(tt,h,j,k,-h,-j,-k,0) rek2(tt,h,j,k,-h,-j,-k,1) rek2(tt,h,j,k,-h,-j,-k,2) rek2(tt,h,j,k,-h,-j,-k,3) rek2(tt,h,j,k,-h,-j,-k,4) rek2(tt,h,j,k,-h,-j,-k,5) } } // inner object (scaled down and rotated) object { #union { #local tt = 25; #local h = 1; #local j = 0.6; #local k = 1; rek2(tt,h,j,k,-h,-j,-k,0) rek2(tt,h,j,k,-h,-j,-k,1) rek2(tt,h,j,k,-h,-j,-k,2) rek2(tt,h,j,k,-h,-j,-k,3) rek2(tt,h,j,k,-h,-j,-k,4) rek2(tt,h,j,k,-h,-j,-k,5) } scale <0.24, 0.24, 0.24> rotate<45,4,6> } object // floor { Floor }