//! Pov-Ray 3.6 // SteSaxBar, Dom 23 Giu 2013, Sab 6 lug 2013 // SteSaxBar-scenes.pov #version 3.6; #declare scene_name="start_scene!" #declare scene_default=off; #declare scene_loc=<0,.5,-4>;//10; #declare scene_cam=on; #declare scene_fog=off; #declare scene_sky=off; #declare scene_rainbow=off; #declare scene_global=on; #declare scene_light=on; #declare scene_floor=off; #declare scene_didascal=on; #declare msg_ident="\n\r\n\rO-> "; //#declare scene_n=0; /*Automatisms*/ #declare ck=13; //0:sky 7:rainbow 9:floor 12:objects 42:scenes 52:textures #declare ckd=0; #declare fn=0; #if(clock_on|clock!=0) #declare ck=clock; #declare ckd=clock_delta;//clock step between frames #declare fn=frame_number;//current #end #warning concat(msg_ident,"Clock is ",str(ck,0,1)," and frame: ",str(fn,0,1)) #ifdef(MyValue) #warning concat(msg_ident,"MyValue ",str(MyValue,0,1))#else #warning concat("MyValue not set")#end #if(ck>=7)#declare scene_sky=on;#end #if(ck>=7)#declare scene_floor=on;#end #if(ck>=12&ck<50)#declare scene_default=on;#end /*Declarements*/ #declare e=exp(1);//2.718281 #declare xy=(x+y); #declare xz=(x+z); #declare yz=(y+z); #declare uv=(u+v); // trigonometricals //#declare deg=function(wa){degrees(wa)}//convert radians to degrees //#declare rg=180/pi; //#declare rad=function(wa){radians(wa)}//convert degrees to radians //#declare gr=pi/180; //#declare r4=sin(pi/4);//.7071 //#declare r8=sin(pi/8);//.3827 //#declare r38=sin(pi/8*3);//.9239 // rotate vector //#declare res=vrotate(<1,0,0>,<0,0,45>); //#declare res=vrotate(res,<45,0,0>); //#warning vstr(3,res,",",0,3) // box inscribe object //#declare sph_min=min_extent(sph()); //#declare sph_max=max_extent(sph()); //#macro strv(wa)concat("<",str(wa.x,0,3),",",str(wa.y,0,3),",",str(wa.z,0,3),","">")#end //#warning concat(strv(sph_min),strv(sph_max)) /*Macros*/ #macro W(wa)wa#end//ONLY Directives|Objects #macro scene_set(wa)#declare scene_name=wa;#end //#macro scene_inc()#declare scene_n=scene_n+1;#end #macro exec(wa,wb,wc)#if(ck=wa)scene_set(wb)wc#end#end //#macro exec(wa,wb)#if(ck=scene_n)scene_set(wa)#macro wc()wb#end wc() scene_inc()#else#warning concat("scene_n:",str(scene_n,0,0)," ck:",str(ck,0,0))#end#end #macro whle(wa,wb,wc,wd)#local i=wa;#while (i<=wc)wd#local i=i+wb;#end#end #macro whl(wa,wb)whle(0,1,wa,wb)#end #macro strv(wa)concat("<",str(wa.x,0,3),",",str(wa.y,0,3),",",str(wa.z,0,3),","">")#end #macro skip_scene()text{ttf "arial.ttf" "Skip rendering!".1 0 tr(.5,0,-x*1.65)tr(1,-y*45,x*.5)}#end #macro wrn(wa)#warning concat(msg_ident,wa,"\n\r")#end #macro wrn2(wa,wb)wrn(concat(wa,wb))#end #macro vnorm(wa)vnormalize(wa)#end #macro vangle(wa,wb)degrees(acos(min(1,vdot(vnorm(wa),vnorm(wb)))))#end #macro vroted(wa)#end #macro vrroted(wa)vroted(vroted(wa))#end #macro vperp(wa,wb)(vnorm(vcross(wa,wb)))#end #macro min_num(wa)#local wb=wa;#if(wb>9.9)#while(wb>9.9)#declare wb=wb/10;#end#else#if(wb>0&wb<1)#while(wb>0&wb<1)#declare wb=wb*10;#end#end#end wb#end /*Transforms*/ #macro tr(wa,wb,wc)transform{scale wa rotate wb translate wc}#end #macro tr_skgrad()tr(2,0,-y)#end #macro tr_skgrad1()tr(2,0,-1.2*y)#end #macro tr_wood()tr(<.227869,.275974,1.01275>,0,<-.35,.095,1.25>)#end /*Colors*/ //#include "colors.inc" #declare blk=rgb 0; // white 111 #declare wht=rgb 1; #declare c_wf8=rgbf<.8,.8,.8,1>; #declare c_wf98=rgbf<.98,.98,.98,.9>; #declare c_wt1=rgbt 1; #declare c_wt2=rgbt.9; #declare c_wt3=rgbt<.75,.75,.75,0>; // red 100 #declare c_r=red 1;//rgb x #declare c_rf1=rgbf<1,.2,.2,.8>; #declare c_rf2=rgbf<1,.5,.2,.8>; // green 010 #declare c_g=rgb y;//green 1; #declare c_g1=rgb<.4,1,.2>; #declare c_gf1=rgbf<.2,1,.2,.8>; // blue 001 #declare c_b=rgb z;//blue 1; #declare c_b1=rgb<.6,.7,1>; #declare c_b2=rgb<0,.1,.8>; #declare c_b3=rgb<0,.3,.8>; #declare c_b4=rgb.61*z; #declare c_bf1=rgbf<.5,.5,1,.8>; #declare c_bf2=rgbf<.2,.2,1,.8>; #declare c_bf3=rgbf<0,0,.8,.5>; // cyan 011 #declare cyan=rgb yz; #declare c_c=rgb yz; #declare c_c1=rgb<.2,.4,1>; #declare c_c9=rgb.9*yz; #declare c_cf1=rgbf<.2,1,1,.8>; // pink 101 #declare pink=rgb xz; #declare c_p=rgb xz; #declare c_pf1=rgbf<1,.5,1,1>; #declare c_pf2=rgbf<1,.5,1,.8>; // orange 150 #declare org=rgb<1,.5,0>;//orange #declare c_o=org; // yellow 110 #declare yel=rgb xy; #declare c_y=rgb yz; #declare c_y1=rgb<1,.4,.2>; #declare c_y2=rgb<.8,.4,.2>; #declare c_y3=rgb<1,.96,0>; #declare c_y4=rgb<1,.501961,.25098>; #declare c_yf1=rgbf<1,1,.2,.8>; #declare c_floor=rgb<1,.8,.6>; #declare c_pelle=rgb<.9,.75,.6>; // hipper 999 #declare c_h1=rgb<1,4,2>; // clear #declare clr=rgbf 1; #macro c_xyz(wa,wb,wc)rgb<1+wa/2,1-wc/2,1+wb/2>*wb#end /*Color_maps*/ #macro cm(wa)color_map{wa}#end #declare cm1=color_map{[.1 blk][.3 c_y2][.5 blk][.7 c_bf3][1 c_wf8]} #declare cm2=color_map{[0 blk][.2 rgb x][.4 yel][1 wht][1 blk]} #declare cm_sky1=color_map{[0 wht][.9 c_c9][1 blk]} #declare cm_bluesky3=color_map{[0 rgb z][.3 rgb<.4,.4,1>][1 rgb 1]} #declare cm_sky5=color_map{[0,.5 color c_wt3 color c_wt2][.5,.7 color c_wt2 color c_wt1][.7,1 color c_wt1 color c_wt1]} #declare cm_starfield1=color_map{[0 .27 color 0 color 0][.27 .28 color <.5,.5,.4>color <.8,.8,.4>][.28 .47 color 0 color 0][.47 .48 color <.4,.4,.5>color <.4,.4,.8>][.48 .68 color 0 color 0][.68 .69 color <.5,.4,.4>color<.8,.4,.4>][.69 .88 color 0 color 0][.88 .89 color .5 color 1][.89 1 color 0 color 0]} #declare cm_rainbow=color_map{[0 c_pf1][.1 c_pf2][.214 c_bf1][.328 c_bf2][.442 c_cf1][.556 c_gf1][.67 c_yf1][.784 c_rf2][.9 c_rf1]} #declare cm_rainbow2=color_map{[0 c_y1][1/3 c_c1][2/3 c_g1][1 c_y1]} #declare cm_bl=color_map{[0 c_b1][.7 c_b2]} #declare cm_bl1=color_map{[0 rgb<.6602,.8021,.868>][.12 rgb<.6602,.8021,.868>][.12 rgb<.6211,.558,.7332>][.74 rgb<.1284,.1723,.9133>][.74 rgb<.2577,.3911,.1019>][0 rgb<.5084,.3372,.825>][1 rgb<.243,.1515,.2866>]} #declare cm_bw=color_map{[.5 blk][.5 wht]} #declare cm_gray=color_map{[0 blk][1 wht]} #declare cm_rc=color_map{[.1 rgb x][.5 clr]} #declare cm_basetex=color_map{[0 rgb.9][.45 rgb.75][.55 rgb<.3,.15,.07>][.65 rgb.75][1 rgb.9]} #declare cm_wood1=color_map{[0 rgb<1,.53373,.11665>][.25 rgb<1,.53373,.11665>][.35 rgb<.66275,.28607,0>][.525 rgb<1,.53363,.11715>][.6 rgb<.66475,.28647,0>][.75 rgb<1,.53353,.11565>][.85 rgb<.66275,.28667,0>][1 rgb<1,.53143,.11795>]} #declare cm_wood2=color_map{[0 rgbf<.56695,.17347,0,.825>][.2 rgbf<.56695,.17347,0,.825>][.35 rgbf<.96471,.5451,.22753,.771>][.4 rgbf<.56341,.17547,0,.915>][.615 rgbf<.96472,.5451,.22553,.759>][.7 rgbf<.56671,.17687,0,.792>][.85 rgbf<.96485,.5451,.22453,.8975>][1 rgbf<.56478,.17247,0,.975>]} #declare cm_pacific=color_map{[0 rgb<.6602,.8021,.868>][.12 rgb<.6602,.8021,.868>][.12 rgb<.6211,.558,.7332>][.74 rgb<.1284,.1723,.9133>][.74 rgb<.2577,.3911,.1019,>][0 rgb<.5084,.3372,.825,>][1 rgb<.243,.1515,.2866,>]} #declare cm_tempest=color_map{[0 rgb<.895833,.1428,.427067>][.34 rgb<.4389,.1428,.426>][.34 rgb<.7746,.8381,.5612>][.22 rgb<.7973,.5913,.037>][.22 rgb<.343733,0,.5729>][1 rgb<.5034,1,.6547>]} #declare cm_fire=color_map{[0 rgb 1][.08 rgbf<.98,1,.02,.08>][.29 rgbf<1,.74,.01,.4>][.53 rgbf<1,.16,.01,.67>][.79 rgbf 1][1 rgbf 1]} #declare cm_amber=color_map{[0 rgb<.95,.72,.05>][.8 rgbf<1,.5,.5,.9>][.8 rgb<1,.8,.8>][1 rgbf<1,.65,.65,.9>]} /*Pigments*/ #macro p_(wa)pigment{wa}#end //patterns principals // agate #macro p_aga(wa)agate agate_turb wa#end #macro p_agt(wa)agate turbulence wa#end #declare p_aga1=pigment{agate/*turbulence.3*/agate_turb.3} #declare p_aga2=pigment{agate scale.3} #declare p_aga3=pigment{p_aga(1)scale.75} #declare p_bluesky3=pigment{p_aga3 cm(cm_bluesky3)}; // bozos #declare p_bozo=pigment{bozo turbulence.3} #declare p_bozo1=pigment{bozo scale.025} #macro p_sky5(wa)pigment{bozo turbulence wa octaves 10 omega.5 lambda 2.5 cm(cm_sky5)scale<1,.3,10>}#end // bricks #declare p_brick=pigment{brick scale.1} #declare p_brick1=pigment{brick rgb<1,1,.5>rgb<1,.5,.4>brick_size.8 mortar.1 rotate x*90} // check #declare p_chek=pigment{checker scale.5} #declare p_chek1=pigment{checker rgb 1 rgb 0 scale.5}//scacchiera #declare p_chek2=pigment{checker rgb x rgb z scale.2} #declare p_mandel=pigment{mandel 200}//fractal // hexagon #declare p_hex=pigment{hexagon scale.2 rotate-x*90} #declare p_hex_tor=pigment{W(p_hex)scale.5 warp{toroidal orientation y dist_exp 1 major_radius 1}rotate-x*90} #declare p_hex_sph=pigment{hexagon scale.1*warp{spherical orientation y dist_exp 1}rotate-x*90} #declare p_ex_cyl=pigment{hexagon scale.1*warp{cylindrical orientation y dist_exp 1}rotate-x*90} // marble #declare p_marble=pigment{marble turbulence.75} #declare p_marble1=pigment{marble turbulence.5 scale<1,3,1>} #declare p_basetex=pigment{marble turbulence.3 omega.4 ramp_wave cm(cm_basetex)scale 1.3} #declare p_amber=pigment{marble cm(cm_amber)turbulence.11 ramp_wave} // radial #macro p_rad(wa)radial frequency wa#end #declare p_rad1=pigment{p_rad(4)} #declare p_rad2=pigment{p_rad(8)} #declare p_rad3=pigment{p_rad(10)} #declare p_wood=pigment{wood turbulence.7} #declare p_wood1=pigment{wood cm(cm_wood1)turbulence.03725 omega.65725 lambda 2.425 ramp_wave scale<.25,.225,1>} #declare p_wood2=pigment{wood cm(cm_wood2)turbulence.0435 omega.65 lambda 3.15 ramp_wave tr_wood()} #declare p_fire=pigment{wood cm(cm_fire)turbulence.2 omega.8 ramp_wave scale<3,7.5,3>} //patterns other #declare p_boxed1=pigment{boxed pigment_map{[0 rgb<.76,1,.766667>][1 rgb<1,.813333,1>]}} #declare p_bumps=pigment{bumps scale.5} #declare p_bumps1=pigment{bumps scale.1} #declare p_bumps2=pigment{bumps scale.05} #declare p_bumps3=pigment{bumps scale.01} #declare p_cel=pigment{cells scale.5} #declare p_crak=pigment{crackle} #declare p_cyl=pigment{cylindrical} #declare p_dent=pigment{dents scale.1} // julia fractal #declare p_julia=pigment{julia<.353,.288>,30 interior 1,1 cm(cm2)scale.5} #declare p_julia1=pigment{julia<.1,.7>,50} #macro p_func(wa)function{wa(x,y,z)}#end // images #declare p_img1=pigment{image_map{png "test.png" interpolate 2 once filter 0 .8 filter 1 .8}tr(1,0,-xy/2)} #macro p_img(wa)image_map{png wa}#end // gradient #macro p_grad(wa)gradient y cm(wa)tr_skgrad()#end #declare p_grad1=pigment{p_grad(cm1)} // granite #macro p_grant(wa)granite turbulence wa#end #declare p_granite=pigment{granite} #declare p_starfield1=pigment{granite cm(cm_starfield1)turbulence 1 sine_wave scale.5} #declare p_leo=pigment{leopard scale.05} #declare p_onion=pigment{onion scale.05} // planar #declare p_plan1=pigment{planar cm(cm_sky1)} #macro p_plan(wa)planar cm(wa)#end // quilted #declare p_quilted=pigment{quilted scale.25} #declare p_quilted1=pigment{quilted control0 1 control1-1 scale 1/3} #declare p_rip=pigment{ripples scale.1} // spiral #declare p_spir1=pigment{spiral1 1 scale.25 cm(cm1)} #declare p_spir1a=pigment{spiral1.5 scale.25 cm(cm1)} #declare p_spir2=pigment{spiral2 1 cm(cm1)} #declare p_spir2a=pigment{spiral2.5 cm(cm1)} #declare p_spot=pigment{spotted scale.1} #declare p_wrink=pigment{wrinkles scale.25} /*Normals*/ #macro n_(wa)normal{wa}#end #declare n_marble1=normal{marble.3 turbulence.5 scale<1,3,1>} #declare n_bumps1=normal{bumps,.5 scale<.05,.05,.3>} #declare n_brick1=normal{brick.5 brick_size.8 mortar.101 rotate x*90} #declare n_wrink1=normal{wrinkles,.5} #declare n_wrink2=normal{wrinkles,.6 scale.15} /*Finish*/ #macro f_(wa)finish{wa}#end #macro f_a(wa)finish{ambient wa}#end #macro f_d(wa)finish{diffuse wa}#end #macro f_r(wa)finish{reflection wa}#end #macro f_s(wa)finish{specular wa}#end #macro f_ad(wa,wb)finish{ambient wa diffuse wb}#end #macro f_ar(wa,wb)finish{ambient wa reflection wb}#end #macro f_as(wa,wb)finish{ambient wa specular wb}#end #macro f_sr(wa,wb)finish{specular wa reflection wb}#end #macro ff_(wa,wb,wc,wd,we,wf,wg,wh,wi,wj,wk,wl,wm,wn,wo,wp,wq,wr,ws,wt,wu,wv) // 0 .6 1 0 40 0 .05 0 (color)0 0 0 ambient wa diffuse wb brilliance wc phong wd phong_size we specular wf roughness wg #if(wh)metallic #end reflection wi crand wj #if(wk)conserve_energy #end // 0 (color)x x(color) x x 1 x #if(wl)reflection{wm wn fresnel wo falloff wp exponent wq metallic wr}#end // 0 x 0 x #if(ws)irid{wt thickness wu turbulence wv}#end#end #declare f_std=finish{ff_(0,.6,1,0,40,0,.05,off,blk,0,off,off,blk,blk,off,0,0,0,off,0,0,0)}; #declare f_glass=finish{ambient 0 diffuse.05 specular.6 roughness.005 reflection{.1,1 fresnel on}conserve_energy} #declare f_granite=finish{ambient.4 phong.63 phong_size 81} #declare f_crystal=finish{ambient.1 diffuse.1 phong 1 phong_size 100 specular.8 roughness.0003 reflection.1} #declare f_metal=finish{ambient.1 diffuse.8 brilliance 6 phong 1 phong_size 80 reflection.7} #declare f_paraf=finish{ambient.3 brilliance 2 phong.3 phong_size 2} #declare f_chrome5c=finish{ambient.25 diffuse.5 brilliance 4 specular.8 roughness.01 reflection.1} #declare f_truck_glass=finish{ambient.8 diffuse.1 phong 1 phong_size 100 reflection.3} #declare f_truck_glass2=finish{ambient.8 diffuse 1 phong 1 phong_size 100 reflection{2,.2 fresnel 0 falloff 1 exponent 1 metallic 0}} #declare f_silver=finish{ambient.3 brilliance 8 phong 1 phong_size 10 reflection.05} #declare f_basetex=finish{ambient.1 specular.75 roughness.02 reflection.125} #declare f_dgray=finish{ambient.3 phong.5 phong_size 10 roughness.9} #declare f_sombr=finish{ambient.2 specular.5 roughness.05 reflection.2} /*Textures*/ #macro t_(wa)texture{wa}#end #macro tp_(wa)texture{pigment{wa}}#end #macro t_dgray(wa)texture{p_(wa)n_(n_wrink1)f_(f_dgray)}#end #declare t_ytr=texture{p_(rgbft<1,1,0,.7,.5>)f_r(.2)} #declare t_rad_rainbow=texture{pigment{p_rad(8) cm(cm_rainbow)}f_s(.6)} #declare t_agate_gray=texture{pigment{agate cm(cm_gray)}f_ad(1,0)} #declare t_agate=texture{p_(p_aga2)f_a(.2)} #declare t_brick=texture{p_(p_brick1)n_(n_brick1)} #declare t_tempest=texture{pigment{p_aga(1)cm(cm_tempest)}finish{ambient .4 phong 1}} #declare t_marble=texture{pigment{p_marble1 cm(cm_rc)}n_(n_marble1)f_as(.2,.2)} #declare t_chek1=texture{p_(p_chek1)f_ar(.6,.2)}//scacchiera #declare t_chek2=texture{p_(p_chek2)f_as(.2,.2)} #declare t_glass=texture{pigment{rgbt 1}finish{f_glass}} #declare t_granite=texture{pigment{granite}f_sr(.3,.2)} #declare t_granite_bl=texture{pigment{p_grant(.4)cm(cm_bl1)}f_(f_granite)} #declare t_pacific=texture{pigment{p_grant(.4)cm(cm_pacific)}f_(f_granite)} #declare t_metal_bl=texture{p_(c_b4)f_(f_metal)} #declare t_chrome5c=material{texture{p_(c_y3)f_(f_chrome5c)}} #declare t_wood35=tp_(p_wood1)texture{pigment{p_wood2}} #declare t_bark1=texture{p_(c_y4)n_(n_wrink2)finish{ambient .1 crand .05}} #declare t_fire=texture{p_(p_fire)} /*Texture_map, tile*/ #declare t_tile=texture{tiles{texture{t_agate}tile2 texture{t_granite}}} #declare tm_dgray=texture{gradient x texture_map{ [0 p_(wht)n_(n_wrink1)finish{f_dgray}][.45 p_(org)n_(n_wrink1)finish{f_dgray}][.5 p_(wht)n_(n_wrink1)finish{f_dgray}] [.55 p_(org)n_(n_wrink1)finish{f_dgray}][1 p_(org)n_(n_wrink1)finish{f_dgray}]}} /*Material*/ #declare m_crystal=material{texture{pigment{c_wf98}finish{f_crystal}}interior{ior 1.45}} #declare m_boxed1=material{texture{p_boxed1}} #declare m_parafin=material{texture{p_(rgb.2)normal{n_bumps1}finish{f_paraf}}} #declare m_truck_glass=material{texture{p_(rgbf.95)finish{f_truck_glass}}} #declare m_silver=material{texture{p_(rgb.658824)finish{f_silver}}} #declare m_basetex=material{texture{pigment{p_basetex}finish{f_basetex}}scale.25} /*Default texture|pigment|normal|finish*/ #macro dft_rainbow()#default{texture{pigment{p_grad(cm_rainbow)}f_ar(.2,.3)}}#end #macro dft_gradient()#default{texture{pigment{gradient y cm(cm2)scale 2 translate-y}}}#end #macro dft_marble()#default{texture{t_marble}}#end #macro dft_ytr()#default{texture{t_ytr}}#end #macro scene_default_on()dft_rainbow()wrn("scene_default:on")#end #if(scene_default)scene_default_on()#end /*Cameras*/ #declare iratio=x*image_width/image_height; #macro cam(wa,wb)camera{location wa direction 1.5*z right iratio look_at wb}#end #macro cam_moray(wa,wb)camera{location wa sky z up z right iratio angle 40 look_at wb}#end //camera{cylinder 1 location scene_loc right x*5 up y*2 look_at 0}//Cylinder types 1,2,3,4 //camera{location scene_loc look_at 0 right iratio aperture 1 blur_samples 2.5 focal_point<0,1,2>confidence.95 variance.005}//blur //camera{location scene_loc look_at 0 right iratio normal{wrinkles.2 scale.3}}//normal //camera{spherical location scene_loc look_at 0 angle 360 180}//spherical: angle horizontal vertical degrees //camera{ultra_wide_angle location scene_loc look_at 0 right iratio angle 90} /*Background*/ background{blk}//filter 1 /*Atmospheric Effects*/ // Fogs #macro fog1()fog{fog_type 2 distance 10 rgb.6 fog_offset.1 fog_alt.2 turbulence.8}#end #macro fog2()fog{fog_type 1 distance 10 rgbft<1,.592157,.882353,.019608,.74902>}#end #if(ck=7)scene_set("fog: 1")fog1()#end #if(ck=8)scene_set("fog: 2")fog2()#end // Skies //#include "skies.inc" #include "stars.inc" #macro sk_1()sky_sphere{pigment{planar cm(cm_sky1)}}#end #macro sk_cloud5()sky_sphere{pigment{rgb<.258,.258,.435>}p_sky5(1.5)p_sky5(.6)p_sky5(.8)}#end//S_Cloud5 #macro sk_bl()sky_sphere{pigment{gradient y cm(cm_bl)tr_skgrad()}}#end #macro sk_bluesky3()sky_sphere{pigment{p_bluesky3}}#end #macro sk_starfield1()sky_sphere{pigment{p_starfield1}}#end #macro sk_cm1()sky_sphere{pigment{gradient y cm(cm1)tr_skgrad1()}}#end #macro sk_cm2()sky_sphere{pigment{gradient y cm(cm2)tr_skgrad()}}#end #if(ck=0)scene_set("sky_sphere: sk1")sk_1()#end #if(ck=1)scene_set("sky_sphere: cloud5")sk_cloud5()#end #if(ck=2)scene_set("sky_sphere: blue")sk_bl()#end #if(ck=3)scene_set("sky_sphere: bluesky3")sk_bluesky3()#end #if(ck=4)scene_set("sky_sphere: starfield1")sk_starfield1()#end #if(ck=5)scene_set("color_map: cm1")sk_cm1()#end #if(ck=6)scene_set("color_map: cm2")sk_cm2()#end // Rainbows #macro rainb(wa)rainbow{angle 40 width 6 distance 1000 direction<0,-.5,1> jitter.01 arc_angle 180 falloff_angle 60/*up*/cm(wa)}#end #if(ck=10)scene_set("rainbow: 1")rainb(cm_rainbow)#end #if(ck=11)scene_set("rainbow: 2")rainb(cm_rainbow2)#end /*Global Settings, Radiosity*/ #macro globals() //global_settings{assumed_gamma 1} //#declare Radiosity=3.3; global_settings{adc_bailout.003922 ambient_light 1 assumed_gamma 1.9 hf_gray_16 0 irid_wavelength<.247059,.176471,.137255>max_intersections 64 max_trace_level 10 number_of_waves 10 charset utf8 #ifdef(Radiosity)radiosity{brightness Radiosity count 100 distance_maximum 0 error_bound.4 gray_threshold.5 low_error_factor.8 minimum_reuse.015 nearest_count 6 recursion_limit 1}#end} //global_settings{adc_bailout.003922 ambient_light 1 assumed_gamma 1.9 hf_gray_16 0 irid_wavelength<.007843,.007843,.007843>max_intersections 64 max_trace_level 10 number_of_waves 10} //global_settings{photons{count 20000 media 100}} //global_settings{radiosity{pretrace_start.08 pretrace_end.01 count 150 nearest_count 10 error_bound.5 recursion_limit 3 low_error_factor.5 gray_threshold 0 minimum_reuse.005/*maximum_reuse.2*/brightness 1 adc_bailout.005}} //global_settings{radiosity{pretrace_start.128 pretrace_end.002 count 500 nearest_count 20 error_bound.5 recursion_limit 2 low_error_factor 1 gray_threshold.0 minimum_reuse.005/*maximum_reuse.1*/brightness 1 adc_bailout.005}} #end /*Lights*/ #macro l1(wa)light_source{wa 1}#end //#declare l1=light_source{scene_loc 1} //light_source{<14,-5,2>.5 media_interaction 0}//for interior room not interaction /*Interiors Materials Medias*/ /*Objects*/ // plane #macro m_floor()plane{y,-1 p_(c_floor)normal{n_marble1}f_ar(.2,.3)}#end #macro m_floor_photon()plane{y,-1 p_(wht)finish{reflection<.5,.4,.2>}photons{target reflection on}}#end exec(9,"plane/floor: marble",m_floor()) // box #macro bx()box{-1 1 scale.5}#end exec(12,"box",object{bx()rotate-x*45+y*15}) // sphere #macro sph()sphere{0 1}#end exec(13,"sphere",sph()) #macro photon(wa,wb)sphere{0 1 pigment{rgbt 1}hollow interior{media{emission 1 density{spherical density_map{[0 rgb 0][.4 rgb wa][.8 rgb wb][1 rgb 1]}}}media{absorption.2}}}#end #macro smog()sphere{0 1 pigment{rgbt 1}hollow interior{media{absorption 7 density{spherical density_map{[0 rgb 0][.5 rgb 0][.7 rgb.5][1 rgb 1]}scale.5 warp{turbulence.5}scale 2}}}/*scale<1.5,6,1.5>*/}#end #macro stone_test()union{sphere{y .5}box{-.5 .5}tr(.8,y*30,0)tr(1,-x*15,-y/4)}#end #macro chess()object{box{<-2,-.1,-2> <2,.1,2>}texture{t_chek1}}#end // cone #macro sphcone(wa)merge{sph()cone{x*cos(acos(1/wa)) sin(acos(1/wa)) x*wa 0}}#end // cylinder #macro axes(wa,wb)cylinder{0 x*wa .1*wb tp_(rgb x)}cylinder{0 y*wa .1*wb tp_(rgb y)}cylinder{0 z*wa .1*wb tp_(rgb z)}#end // torus #macro tor()torus{1 .5}#end exec(14,"torus",object{tor()tr(.5,-x*45,0)}) // disco #macro disco(wa)disc{0,y,1,wa}#end exec(15,"disco",disco(.2)) // text arial arialuni century comic.ttf cour crystal cyrvetic hebrew impact povlogo symbol times timrom verdana webdings wingding wingdng2 wingdng3 #macro o_text(wa) text{ttf "arial.ttf" wa.1 0 translate-x} #end exec(16,"text_arial",o_text("Bye!")) // union intersection difference merge #declare spaceship1=merge{object{sphcone(5)rotate y*90} merge{sphcone(5)tr(.5,y*90,<2,-1,-.5>)}cylinder{0 <2,-2,-.5> .2 scale y/2} merge{sphcone(5)tr(.5,y*90,<-2,-1,-.5>)}cylinder{0 <-2,-2,-.5> .2 scale y/2}} // superellipsoid exec(17,"superellipsoid: cube", superellipsoid{.1*uv tr(.8,y*30,0)})//cube exec(18,"superellipsoid: botton_quadre", superellipsoid{<0.1,0.9>tr(.8,y*30,0)})//botton quadre exec(19,"superellipsoid: botton", superellipsoid{<.5,1>tr(.8,y*30+x*90,0)}) exec(20,"superellipsoid: cylinder", superellipsoid{<0.9,0.1>tr(.8,y*30,0)})//cylinder exec(21,"superellipsoid: sphere", superellipsoid{.9*uv tr(.8,y*30,0)})//sphere exec(22,"superellipsoid: difference", difference{superellipsoid{<1,.25>scale 1}superellipsoid{<1,.25>scale (z+y)*.8+x*2}tp_(wht)tr(.6,y*120,0)}) // blob #declare rv=1;//radius #declare sv=1;//strength exec(23,"blob", blob{threshold.6 sphere{x*.75 rv sv} sphere{<-.375,.65,0> rv sv} sphere{<-.375,-.65,0> rv sv} cylinder{-z z rv sv}scale.75}) // cubic, quadric exec(24,"cubic", intersection{sph() //x2,xy,xz,x,y2,yz,y,z2,z,C (2°) // x3,x2y,x2z,x2,xy2,xyz,xy,xz2,xz,x,y3,y2z,y2,yz2,yz,y,z3,z2,z,C (3°) cubic{<1, 0, 0, 0, 0, 1, 0, 0, 0,0, 1, 0, 0, 0, 0,1, 0, 0,0,1>scale.01}}) exec(25,"quadric", intersection{sph() // x2 y2 z2 xy xz yz x y z c quadric{<0, 1, 1><1, 0, 0><0,3,0>2 tr(.05,y*45,0)}}) //intersection{sph()quadric{yz x 3*y 2 tr(.05,y*45,0)}} // fractal exec(26,"fractal_julia", julia_fractal{<-.083,0,-.83,-.025> quaternion cube max_iteration 8 precision 20}) // height_field png: bumpmap_ fract003 mtmandj plasma2 plasma3 povmap test exec(27,"height_field: fract003", height_field{png "fract003.png" tr(.1*y,-x*15,<-.5,0,-2>)}) exec(28,"height_field: plasma3", height_field{png "plasma3.png"texture{pigment{image_map{png "plasma3.png" map_type 0 interpolate 2 once}rotate x*90}}tr(.1*y,-x*15,<-.5,0,-2>)}) // functions #declare fn_X1=function(x,y,z){x*x+y*y-1}//cylinder #declare fn_X2=function(x,y,z){x*x+y*y+z*z-1}//sphere #declare fn_X3=function(x,y,z){x*x+z*z+y-1}//blobed cone exec(29,"function_cylinder", isosurface{function{fn_X1(x,y,z)}contained_by{box{-1.2 1.2}}accuracy.001 max_gradient 4 tr(.5,-y*30,0)}) exec(30,"function_sphere", isosurface{function{fn_X2(x,y,z)}contained_by{box{-1.2 1.2}}accuracy.001 max_gradient 4 tr(.5,-y*30,0)}) exec(31,"function_blobed_cone", isosurface{function{fn_X3(x,y,z)}contained_by{box{-2 2}}accuracy.001 max_gradient 4 scale.5}) exec(32,"parametric_function",/*skip_scene()*/ parametric{function{u*v*sin(15*v)},function{v},function{u*v*cos(15*v)}<0,0>,<1,1>contained_by{box{-1 1}}accuracy.005 precompute 15 x,y,z tr(1,180*x,y/2)}) // lathe, polygons, prism, triangle smooth_triangle, sphere_sweep, sor exec(33,"lathe", lathe{linear_spline 5,<1,0>,<3,0>,<3,5>,<1.5,4.5>,<1,0>tr(.2,-x*30,-y/2)}) exec(34,"polygon", polygon{12<0,0>,<0,6>,<4,6>,<4,3>,<1,3>,<1,0>,<0,0>,<1,4>,<1,5>,<3,5>,<3,4>,<1,4> rotate y*45 scale.25 translate-y/2}) exec(35,"prism", prism{linear_sweep linear_spline-.5,.5,10,<.2,-1>,<.2,.2>,<1,-.2>,<1,.2>,<.2,1>,<-.2,1>,<-1,.2>,<-1,-.2>,<-.2,.2>,<-.2,-1>tr(.75,-x*80,0)}) #declare guitar=union{ prism{linear_sweep cubic_spline -1 0 7<.341826,.713376>,<-.47983,.522293>,<-.225053,-.62845>,<.363057,-.320594>,<.341826,.713376>,<-.47983,.522293>,<-.225053,-.62845>scale<.45,.01,.45>rotate<-90,0,-90>translate<.5,0,.1>tp_(blue 1)} prism{linear_sweep cubic_spline -1 0 18<-.068398,-.172192>,<-.292481,-.043303>,<-.315615,-.747191>,<-.184046,-.961648>,<.055524,-.996584>,<.330735,-1.146329>,<.388812,-.764916>,<.357151,.061123>,<.220467,-.143186>,<.100886,-.112798>,<.094201,1.027254>,<.111323,1.261292>,<-.160911,1.722532>,<-.132275,1.293392>,<-.03567,1.056428>,<-.068398,-.172192>,<-.292481,-.043303>,<-.315615,-.747191>scale<1,.1,1>rotate<-90,0,90>tp_(blk)}} exec(36,"triangle", triangle{<-1,0,-1>,<1,0,-1>,<0,0,1>rotate-x*15}) exec(37,"smooth_triangle", smooth_triangle{<0,3,0><0,.7071,-.7071> <4,-2,0><0,-.8664,-.5> <0,0,0><0,-.5,-.8664>scale.25}) exec(38,"sphere_sweep", sphere_sweep{linear_spline 4,<-1,-1,0>,.1 <-1,1,0>,.1 <1,-1,0>,.1 <1,1,0>,.1})//sphere drawing exec(39,"sor", sor{7,<0,0><.118143,0><.620253,.540084><.210970,.827004><.194093,.962025><.286920,1><.468354,1.033755>tr(1,-x*15,-y/2)}) // bicchiere #declare bicchiere=lathe{linear_spline 23 <-.002556,-.395281>,<.080659,-.410489>,<.304265,-.445079>,<.303401,-.427463>,<.181876,-.392243>, <.128786,-.362646>,<.088277,-.314875>,<.075357,-.25486>,<.079222,-.194812>,<.09973,-.145982>, <.140232,-.095431>,<.190105,-.079135>,<.223725,-.052472>,<.236717,-.004371>,<.240321,.136936>, <.225276,.986907>,<.209126,.997687>,<.197837,.9793>,<.210866,.179284>,<.193722,.037728>, <.176406,.012763>,<.14344,-.003708>,<.000466,-.016316>material{m_crystal}} // bicubic exec(40,"bicubic_patch", bicubic_patch{type 1 flatness.1 u_steps 4 v_steps 4 <0,0,1><1,0,0><2,0,0><3,0,-1> <0,1,0><1,1,-1><2,1,0><3,1,0> <0,2,0><1,2,0><2,2,1><3,2,0> <0,3,1><1,3,0><2,3,0><3,3,-1> uv_mapping texture{t_chek2}tr(1,<90,-30,0>,-x/2)}) // mesh exec(41,"mesh", #declare T1=tp_(red 1)#declare T2=tp_(green 1)#declare T3=tp_(blue 1) #declare p=array[8]{<1,1,1>,<1,1,-1>,<1,-1,1>,<1,-1,-1>,<-1,1,1>,<-1,1,-1>,<-1,-1,1>,<-1,-1,-1>} mesh{triangle{p[5],p[1],p[0]texture{T1}}triangle{p[5],p[4],p[0]texture{T1}} triangle{p[3],p[2],p[0]texture{T2}}triangle{p[3],p[1],p[0]texture{T2}} triangle{p[7],p[3],p[5]texture{T3}}triangle{p[5],p[1],p[3]texture{T3}} texture{pigment{rgb.9}f_ad(.2,.7)}tr(.5,xy*135,0)}) /*Scenes*/ exec(42,"scacchiera",object{chess()tr(.7,-x*15,0)}) exec(43,"lathe: bicchiere",object{bicchiere}) // Random spheres #if(ck=44) scene_set("scene: random_spheres")/*skip_scene()*/ #declare R1=seed(2); #declare R2=seed(11111); #declare i=0; #while (i<=5) sphere{,rand(R2)} #declare i=i+1; #end//while i //whl(5,sphere{,rand(R2)}) #end//if ck // Trace function #if(ck=45) scene_set("scene: trace function") #declare scene_floor=off; #declare scene_loc=<5,5,5>; cylinder{0 x*3 .01 tp_(rgb x)} cylinder{0 y*3 .01 tp_(rgb y)} cylinder{0 z*3 .01 tp_(rgb z)} #declare obj_trace=box{-.5 .5 rotate 30}//sphere{-.75*x 1} #declare vstart=z; #declare v_norm=<0,0,0>; #declare vstop=v_norm-vstart; #declare vinter=trace(obj_trace,vstart,vstop,v_norm); object{obj_trace tp_(wht)} #if(vlength(v_norm)!=0)cylinder{vinter,vinter+v_norm,.05 tp_(wht/2)}#end wrn2("start:",strv(vstart)) wrn2("stop:",strv(vstop)) wrn2("norm:",strv(v_norm)) wrn2("inter:",strv(vinter)) #end // SpaceShip #if(ck=46) scene_set("scene: spaceship") #declare scene_floor=off; #declare scene_sky=off;sk_starfield1() object{spaceship1 tp_(wht)tr(.25,<-45,-15,0>,0)} #end // Sombrero #if(ck=47) scene_set("scene: sombrero") #declare n=12;//6,8,16 #declare shape=sph()//torus{.1,.75}//box{-.75 .75 rotate-y*45} #declare i=.5/n;#declare pz=-1;#while(pz<=1) union{#declare px=-1;#while(px<=1) #declare py=sin(sqrt(px*px+pz*pz)*pi*4); object{shape tr(i,0,)texture{p_(c_xyz(px,py,pz))f_(f_sombr)}} #declare px=px+i;#end rotate-x*30} #declare pz=pz+i;#end #end // Guitar #if(ck=48)scene_set("scene: guitar")#declare scene_floor=on;object{guitar rotate y*180}#end // Edificio #if(ck=49)scene_set("scene: edificio") #declare scene_floor=on; union{//edificio //tetto cono cone{0 0 z 1 tr(2*z,-180*x,7*z)} //tetto ciambella torus{1.5 .5 tr(1,-90*x,5.570446*z)} #declare profilo_porta=prism{linear_sweep cubic_spline -1 0 9<-.323481,.348859>,<-1.29724,-.273885>,<-.989384,-1>,<.03397,-1.042463>,<.145966,.021231>,<.023355,1.063694>,<-.323481,.348859>,<-1.29724,-.273885>,<-.989384,-1>rotate-x*90 tr(.1*z,0,<9.550538,9.918055,-.05>)} //edificio cubo difference{box{-1 1 scale 2} union{ union{box{-1 1 tr(<.480303,1,.05>,0,<9.181315,8.084177,0>)} profilo_porta translate<.035068,.048345,.351269>} union{ union{box{-1 1 tr(<.480303,1,.05>,0,<9.181315,8.084177,0>)} profilo_porta translate<-4.254398,.386763,0>} rotate<180,0,-180>translate<14.945324,-.343092,.351326>} tr(<.75,.746658,30>,<90,0,180>,<7.206291,-11.066959,-7.389677>)} scale.979752*z} //tetto sfera sphere{0 1 tr(2.5,0,<0,.069948,3.357502>)} //porta dx union{box{-1 1 tr(<.480303,1,.05>,0,<9.181315,8.084177,0>)} profilo_porta tr(<.76,.76,1>,<90,0,-49.193455>,<-4.974321,2.827133,-7.394706>)} //porta sx union{box{-1 1 tr(<.480303,1,.05>,0,<9.181315,8.084177,0>)} profilo_porta tr(<.760295,.703812,.999873>,<89.866028,.29291,-165.692474>,<7.137018,-.408954,-6.941484>)} //torre union{cylinder{z 0 1 tr(<.5,.5,4>,0,<-.512722,-2.512777,-1.905091>)} sphere{0 1 translate<-.518614,-2.503596,2.92697>}translate<6,2.5,0>} tr(.15,<-90,180,0>,0)tp_(rgb<.9,.75,.6>)} #end // Test colors #if(ck=50)scene_set("scene: test colors") #declare scene_floor=off; #declare stps=.1; merge{ #declare px=0;#while(px<=1) #declare py=0;#while(py<=1) #declare pz=0;#while(pz<=1) sphere{-.5 .025 pigment{rgb }}//stps/2-stps/20 #declare pz=pz+stps;#end #declare py=py+stps;#end #declare px=px+stps;#end rotate y*120+x*15} #end //... /*Test Texture Materials Maps*/ exec(51,"fotone",photon(x,xy)) exec(52,"smog",smog()) exec(53,"texture: granite_bl",object{stone_test()texture{t_granite_bl}}) exec(54,"texture: ytr",object{stone_test()texture{t_ytr}}) exec(55,"texture: rad_rainbow",object{stone_test()texture{t_rad_rainbow}}) exec(56,"texture: glass",object{stone_test()texture{t_glass}}) exec(57,"texture: agate_gray",object{stone_test()texture{t_agate_gray}}) exec(58,"texture: agate",object{stone_test()texture{t_agate}}) exec(59,"texture: brick",object{box{<-.1,-7.5,-1> <.1,7.5,2>}texture{t_brick}tr(.2,yz*90,0)}) exec(60,"texture: marble",object{stone_test()texture{t_marble}}) exec(61,"texture: granite",object{stone_test()texture{t_granite}}) exec(62,"material: crystal",object{stone_test()material{m_crystal}}) exec(63,"material: boxed1",object{stone_test()material{m_boxed1}}) exec(64,"texture: metal_bl",object{stone_test()texture{t_metal_bl}}) exec(65,"material: parafin",object{stone_test()material{m_parafin}}) exec(66,"material: truck_glass",object{stone_test()material{m_truck_glass}}) exec(67,"material: silver",object{stone_test()material{m_silver}}) exec(68,"material: basetex",object{stone_test()material{m_basetex}}) exec(69,"texture: wood35",object{stone_test()texture{t_wood35}}) exec(70,"texture: dgray_orange",object{stone_test()t_dgray(org)}) exec(71,"tile: tile",object{stone_test()texture{t_tile}}) exec(72,"texture_map: dgray",object{stone_test()texture{tm_dgray}}) exec(73,"texture: bark1",object{stone_test()texture{t_bark1}}) exec(74,"texture: pacific",object{stone_test()texture{t_pacific}}) exec(75,"texture: fire",object{stone_test()texture{t_fire}}) exec(76,"texture: amber",object{stone_test()texture{p_(p_amber)}}) #declare lastn=77; //#declare ck=lastn; //exec(lastn,"finish test",object{stone_test()texture{t_tempest}}) #if(ck>=lastn)scene_set("overflow scene! The End.")#end //scene_default declared first of objects #if(scene_cam)cam(scene_loc,0)wrn("scene_cam:on")#end #if(scene_fog)fog1()wrn("scene_fog:on")#end #if(scene_sky)sk_cloud5()wrn("scene_sky:on")#end #if(scene_rainbow)rainb(cm_rainbow)wrn("scene_rainbow:on")#end #if(scene_global)globals()wrn("scene_global:on")#end #if(scene_light)l1(scene_loc)wrn("scene_light:on")#end #if(scene_floor)m_floor()wrn("scene_floor:on")#end #if(scene_didascal)wrn("scene_didascal:on")wrn2("scene_name:",scene_name) text{ttf "arial.ttf" scene_name.1 0 p_(wht)tr(.025,0,scene_loc-<.21,.22,-.5>)} text{ttf "arial.ttf" concat("ck: ",str(ck,0,0)).1 0 p_(wht)tr(.025,0,scene_loc-<.21,.22,-.54>)} #end /*Arrays #declare Points=array[16]{ <0,0,2><1,0,0><2,0,0><3,0,-2> <0,1,0><1,1,0><2,1,0><3,1,0> <0,2,0><1,2,0><2,2,0><3,2,0> <0,3,2><1,3,0><2,3,0><3,3,-2>} #declare p=array[8]{<0,0,0>,<0,0,1>,<0,1,0>,<0,1,1>,<1,0,0>,<1,0,1>,<1,1,0>,<1,1,1>} #declare p=array[8]{<-1,-1,-1>,<-1,-1,1>,<-1,1,-1>,<-1,1,1>,<1,-1,-1>,<1,-1,1>,<1,1,-1>,<1,1,1>} #declare p=array[6]{<1,2,3>,<1,3,2>,<2,1,3>,<2,3,1>,<3,1,2>,<3,2,1>} #declare p=array[6]{<0,.5,1>,<0,1,.5>,<.5,0,1>,<.5,1,0>,<1,0,.5>,<1,.5,0>} */ //Strings unicode_char \uNNNN null \0 backslash \\ s_quote \' d_quote \" /*asc(S1)//Convert 1st character of S1 to ASCII value val(S1)//Convert string S1 to float chr(A)//Convert extended ASCII value A to a 1 character string str(A,L,P)//Convert float A to string, at least L characters long, with P digits after the decimal point (if P is -1, make max) vstr(3,<1,2,3>,",",0,3)//Vector to string strlen(S1)//Returns # of characters in string S1 concat(S1,S2)//combine S1 and S2 into one long string substr(S1,P,L)//Sub-string from S1, start at position P for length L strcmp(S1,S2)//compare S1 to S2, return -1, 0, or +1 if S2 is <, =, > than S1*/ /*Directives #debug "During scene parsing, general info message" #warning "During scene parsing" #error "During scene parsing" #if(a) #else #end #switch(a) #case(0) #break #range(0,1) #break #else #end #declare i=0; #while(i<=5) #declare i=i+1; #end #fopen f "filename.ext" append //write read #while(defined(f)) .. #end #read(f,v1,v2,v3) #write(f,v1,v2,v3) //FLOAT|VECTOR|STRING #fclose f */