/** * A doodle - Initially it was a set of bubbles... now it's a set of clocks! * * pg-20131128 */ //-------------------------------------------------------------------------- global_settings { assumed_gamma 1.1 } background {color srgb<3,38,66>/255} #default{ finish{ambient 0.1 diffuse 0.9 } } //-------------------------------------------------------------------------- #include "colors.inc" // camera ------------------------------------------------------------------ #declare Camera_0 = camera {/*ultra_wide_angle*/ angle 75 // front view location <0.0 , 1.0 ,-3.0> right x*image_width/image_height look_at <0.0 , 1.0 , 0.0>} #declare Camera_1 = camera {/*ultra_wide_angle*/ angle 90 // diagonal view location <2.0 , 2.5 ,-3.0> right x*image_width/image_height look_at <0.0 , 1.0 , 0.0>} #declare Camera_2 = camera {/*ultra_wide_angle*/ angle 90 // right side view location <3.0 , 1.0 , 0.0> right x*image_width/image_height look_at <0.0 , 1.0 , 0.0>} #declare Camera_3 = camera {/*ultra_wide_angle*/ angle 90 // top view location <0.0 , 3.0 ,-0.001> right x*image_width/image_height look_at <0.0 , 1.0 , 0.0>} camera{Camera_0} // lights ------------------------------------------------------------------ #declare light_color=srgb<250,250,200>/255; light_source{ <-1000, 800, -3000> color light_color} //-------------------------------------------------------------------------- #declare t_bubble=texture{ //pigment {color srgb<32,73,110>/255 transmit 0.8} pigment {color srgb<57,93,180>/255 transmit 0.9} finish {phong 0.5} normal {granite 0.1 scale 0.02} } #declare r_bubble=0.5; #declare h_bubble=0.02; #declare i_bubble=0.05; #declare r_tick=0.05; // Initially it was a bubble... now it's a clock! #declare the_bubble=union { torus{r_bubble-i_bubble i_bubble} cylinder{<0,-h_bubble,0> <0,h_bubble,0> r_bubble-i_bubble} } // Add some ticks #declare the_bubble=union { object{the_bubble} #local i=0; #while(i<12) sphere{<0,0,0> r_tick translate <(r_bubble-2*i_bubble)*cos(pi*i/6),0,(r_bubble-2*i_bubble)*sin(pi*i/6)>} #local i=i+1; #end } // Hands #declare r_hand=r_tick/4; #declare epsilon=0.01; #declare hand_m=difference{ cone{<0,0,0> r_hand <0,0,r_bubble-2*i_bubble-r_tick> 0} box{<-r_hand-epsilon,-r_hand-epsilon,-r_hand-epsilon> } } #declare hand_h=object{hand_m scale <1,1,0.7>} // Now, a macro #macro bubble_clock(hh,mm) #local alfa_h=30*(hh+mm/60); #local alfa_m=6*mm; union { object{the_bubble} object{hand_m translate <0,r_tick/2,-r_tick> rotate <0,alfa_m,0>} object{hand_h translate <0,r_tick/2,-r_tick> rotate <0,alfa_h,0>} sphere{<0,0,0> r_hand*2 translate <0,r_tick/2,0>} } #end #declare v_from=<-4,-4,-2>; #declare v_to=<4,4,4>; #declare v_step=0.8; #declare p_hole=0.8; #declare ix=v_from.x; #declare iy=v_from.y; #declare iz=v_from.z; #declare R1=seed(123); #declare R2=seed(456); #declare p_hole=0.6; #for(ix,v_from.x,v_to.x,v_step) #for(iy,v_from.y,v_to.y,v_step) #for(iz,v_from.z,v_to.z,v_step) #if(rand(R2)>p_hole) object{bubble_clock(floor(24*rand(R1)),floor(60*rand(R1))) scale(0.8+rand(R1)*0.4) rotate <-90,40-rand(R1)*80,0> translate texture{t_bubble}} #end #end #end #end