/* * Concept: some spotlights pointed to a Text, creating a phrase. * * * ToDo: A ground different from a plane? * * * Paolo Gibellini, december 2010 */ #include "functions.inc" // Parameters --------------------- #declare rad_on=0; #declare show_floor=1; #declare show_text=0; #declare show_sphere=0; #declare show_stars=1; #declare show_spots=1; #declare show_media=1; #declare blur_on=0; #declare show_area_light=0; #declare color_spots=1; #declare message1="Merry"; #declare message2="X-mas"; //#declare message1="Buon"; //#declare message2="Natale"; // -------------------------------- // Global settings ------------------------ /* #default { texture { finish {ambient 0.9} } } */ global_settings { adc_bailout 0.003922 //ambient_light <1.0,1.0,1.0> //ambient_light <24,51,82>/255 ambient_light <0.4,0.4,1.0> assumed_gamma 1.9 hf_gray_16 off irid_wavelength <0.247059,0.176471,0.137255> max_intersections 64 max_trace_level 10 number_of_waves 10 noise_generator 2 charset ascii #if(rad_on) radiosity { pretrace_start 0.08 // start pretrace at this size pretrace_end 0.04 // end pretrace at this size count 35 // higher -> higher quality (1..1600) [35] nearest_count 5 // higher -> higher quality (1..10) [5] error_bound 1.8 // higher -> smoother, less accurate [1.8] recursion_limit 3 // how much interreflections are calculated (1..5+) [3] low_error_factor .5 // reduce error_bound during last pretrace step gray_threshold 0.0 // increase for weakening colors (0..1) [0] minimum_reuse 0.015 // reuse of old radiosity samples [0.015] brightness 1 // brightness of radiosity effects (0..1) [1] adc_bailout 0.01/2 //normal on // take surface normals into account [off] //media on // take media into account [off] //save_file "file_name" // save radiosity data //load_file "file_name" // load saved radiosity data //always_sample off // turn sampling in final trace off [on] //max_sample 1.0 // maximum brightness of samples } #end } #if(show_media) media { intervals 10 //scattering { 1, rgb 0.03 } scattering { 5, .1 extinction .1 eccentricity .4 } samples 1, 10 confidence 0.9999 variance 1/1000 ratio 0.9 } #end // ---------------------------------------- // Camera --------------------------------- #declare camera_location = <0,15,-14>; #declare camera_look_at = <0,8,0> ; camera { location camera_location //angle 40 look_at camera_look_at #if(blur_on=1) aperture 0.105 // [0...N] larger is narrower depth of field (blurrier) blur_samples 5 // number of rays per pixel for sampling focal_point <0,0,-0.5> // point that is in focus confidence 0.5 // [0...<1] when to move on while sampling (smaller is less accurate) variance 0.2 // [0...1] how precise to calculate (smaller is more accurate) #end } // ---------------------------------------- // Textures ------------------------------- #declare t_3=texture { pigment { average pigment_map { [1.0 rgb <1,0.8,0.8>*0.4] [2.0 rgb <0.6,1,0.6>*0.4] } } normal{ average normal_map{ [1.0 bumps 0.1] [2.0 bumps 0.4 rotate 60 scale .015] [4.0 bumps 0.2 rotate 120 scale .005] //[6.0 bumps 0.05 translate <0.5,0,0.5>] } } #if (!rad_on) finish{diffuse 1.3 phong .1} #end } #declare t_3=texture { pigment { average pigment_map { [1.0 rgb <1,0.8,0.8>*0.4] [2.0 rgb <0.6,1,0.6>*0.4] } } normal{ average normal_map{ [1.0 bumps 0.1] [2.0 bumps 0.4 rotate 60 scale .015] [4.0 bumps 0.2 rotate 120 scale .005] //[6.0 bumps 0.05 translate <0.5,0,0.5>] } } #if (!rad_on) finish{diffuse 1.3 phong .1} #end } #declare t_purple = texture { pigment{color rgb<85,0,6>/255} finish {ambient 0.15 diffuse 0.85 phong 1} } #local hm=<0.95,0.95,1>; #declare t_mirror=texture{ pigment{color rgb hm} finish { //ambient .2 //diffuse .6 //phong 0.275 //phong_size 50 //specular 1.0 //roughness 0.001 reflection 0.9 } normal{ //agate 0.05 //granite 0.051 //bumps 0.5 //marble 0.2 //wrinkles 0.4 //crackle 0.4 agate 0.02 //turbulence 0.5 } //scale 0.01 scale 0.1 } #declare t_mirror_purple=texture{ checker texture{t_purple} texture{t_mirror} scale 0.1 } #declare t_star = texture { pigment{color rgbf<1,0.7,0,0.8>} } #declare t_star_border = texture { pigment{color rgbt <0.98,0.57,0,0>} finish { reflection 0.9 } normal{ agate 0.02 } //scale 0.01 scale 0.1 } // ---------------------------------------- // Objects -------------------------------- //The star #declare the_star=cylinder{<0,0,0> <0,0.1,0> 0.5 texture{t_star}}; //Base for the star #local palfa=36; #local pbeta=(180-27); #local ptalfa=tan(palfa*pi/180); #local ptbeta=tan(pbeta*pi/180); #local pl=1; #local ph=0.1; #local pepsilon=0.01; #local pX=ptbeta*pl/(ptbeta-ptalfa); #local pY=pX*ptalfa; #local pK=pY/sin(pbeta*pi/180); #declare pbase=difference{ cylinder{<0,-ph/2,0> <0,ph/2,0> pl} #local i=0; #while(i<5) union { box{<0,-ph/2-pepsilon,0> rotate -pbeta*y translate } box{<0,-ph/2-pepsilon,0> rotate -pbeta*y translate scale <1,1,-1>} rotate 72*i*y } #local i=i+1; #end } /* difference{ object{pbase} object{pbase scale <0.8,1+2*pepsilon,0.8>} texture{pigment{rgbt <0.9,0.6,0.6,0>}} } object{pbase scale <0.82,0.6,0.82> texture{pigment{rgbt <1,0,0,0.8>}}} */ #declare the_star=union{ difference{ object{pbase} object{pbase scale <0.8,1+2*pepsilon,0.8>} texture{t_star_border} } object{pbase scale <0.82,0.6,0.82> texture{t_star}} //scale 0.7 } #macro put_the_star(with_a_color) union{ difference{ object{pbase} object{pbase scale <0.8,1+2*pepsilon,0.8>} texture{t_star_border} } object{pbase scale <0.82,0.6,0.82> pigment{color rgbf with_a_color} } //scale 0.7 scale 1.5 } #end // The text #declare row1=text { ttf "times.ttf", message1, 1, 0} #declare row2=text { ttf "times.ttf", message2, 1, 0} #declare row1=object {row1 rotate <90, -10, 0> scale 4 translate <-4.5, 0.05, 2.5>} #declare row2=object {row2 rotate <90, -10, 0> scale 4 translate <-5, 0.05, -2.5>} #if(show_text) object {row1 texture{pigment {color rgb z}}} object {row2 texture{pigment {color rgb x}}} #end // The lights #declare l_radius=0.12; //0.2 #declare l_falloff=0.18; //0.20; //0.4 #declare l_tightness=30; #declare l_height=20; #if(show_spots) #declare R1=seed(2010); #declare R2=seed(12); #declare R3=seed(25); #declare m_steps=100; //100 #declare r_stop=0.3; //0.3 #declare s_stop=0.2; //0.2 #declare Normal=<0,0,0>; // First row #declare m_min=min_extent(row1); #declare m_max=max_extent(row1); #local i=0; #while (i<=m_steps) #local j=0; #local m_x=m_min.x+(m_max.x-m_min.x)*i/m_steps; #while (j<=m_steps) #local m_z=m_min.z+(m_max.z-m_min.z)*j/m_steps; #if(rand(R1)<=r_stop) #declare Intersection=trace(row1, , -y, Normal); #if(vlength(Normal) > 0) #local correction=0.5+rand(R2)*2; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; #local the_origin=; #local the_point=; light_source { 0*x // light's position (translated below) #if(color_spots) color rgb <1-rand(R3)*0.5,1-rand(R3)*0.5,1-rand(R3)*0.5> // light's color #else color rgb 1 #end spotlight // this kind of light source radius l_radius // hotspot (inner, in degrees) tightness l_tightness // tightness of falloff (1...100) lower is softer, higher is tighter falloff l_falloff // intensity falloff radius (outer, in degrees) translate the_origin // position of light point_at the_point // direction of spotlight } #if(show_stars & rand(R3)<=s_stop & the_origin.y>4) #local star_center=(the_origin-the_point)*0.6; #local delta_x=the_origin.x-the_point.x; #local delta_y=the_origin.y-the_point.y; #local delta_z=the_origin.z-the_point.z; #local alfa_x=atan2(delta_z,delta_y); #local alfa_y=atan2(delta_z,delta_x); #local alfa_z=atan2(delta_x,delta_y); //object{the_star translate star_center rotate } //object{the_star translate star_center rotate *180/pi} //object{the_star rotate *180/pi translate star_center} //object{put_the_star(<1-rand(R3)*0.2,1-rand(R3)*0.3,0.5-rand(R3)*0.5,0.8>) rotate *180/pi translate star_center} //object{put_the_star(<1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.2>) rotate *180/pi translate star_center} object{put_the_star(<1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.2>) rotate *180/pi translate star_center double_illuminate} #end #end #end #local j=j+1; #end #local i=i+1; #end // Second row #declare m_min=min_extent(row2); #declare m_max=max_extent(row2); #local i=0; #while (i<=m_steps) #local j=0; #local m_x=m_min.x+(m_max.x-m_min.x)*i/m_steps; #while (j<=m_steps) #local m_z=m_min.z+(m_max.z-m_min.z)*j/m_steps; #if(rand(R1)<=r_stop) #declare Intersection=trace(row2, , -y, Normal); #if(vlength(Normal) > 0) #local correction=0.5+rand(R2)*2; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; //#local the_origin=; #local the_origin=; #local the_point=; light_source { 0*x // light's position (translated below) #if(color_spots) color rgb <1-rand(R3)*0.5,1-rand(R3)*0.5,1-rand(R3)*0.5> // light's color #else color rgb 1 #end spotlight // this kind of light source radius l_radius // hotspot (inner, in degrees) tightness l_tightness // tightness of falloff (1...100) lower is softer, higher is tighter falloff l_falloff // intensity falloff radius (outer, in degrees) translate the_origin // position of light point_at the_point // direction of spotlight } #if(show_stars & rand(R3)<=s_stop & the_origin.y>4) #local star_center=(the_origin-the_point)*0.6; #local delta_x=the_origin.x-the_point.x; #local delta_y=the_origin.y-the_point.y; #local delta_z=the_origin.z-the_point.z; #local alfa_x=atan2(delta_z,delta_y); #local alfa_y=atan2(delta_z,delta_x); #local alfa_z=atan2(delta_x,delta_y); //object{the_star translate star_center rotate } //object{the_star translate star_center rotate *180/pi} //object{the_star rotate *180/pi translate star_center} //object{put_the_star(<1-rand(R3)*0.2,1-rand(R3)*0.3,0.5-rand(R3)*0.5,0.8>) rotate *180/pi translate star_center} //object{put_the_star(<1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.2>) rotate *180/pi translate star_center} object{put_the_star(<1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.3,1-rand(R3)*0.2>) rotate *180/pi translate star_center double_illuminate} #end #end #end #local j=j+1; #end #local i=i+1; #end #else // A spotlight #declare base_spot=light_source { 0*x // light's position (translated below) color rgb <1,1,1> // light's color spotlight // this kind of light source radius l_radius // hotspot (inner, in degrees) tightness l_tightness // tightness of falloff (1...100) lower is softer, higher is tighter falloff l_falloff // intensity falloff radius (outer, in degrees) translate <2,20,0> // position of light point_at <0,0,0> // direction of spotlight } light_source { base_spot } #end // More light #if(show_area_light) // An area light (creates soft shadows) light_source { 0*x // light's position (translated below) color rgb <1.0,1.0,0.4> // light's color area_light //<8, 0, 0> <0, 0, 8> // lights spread out across this distance (x * z) <8, 0, 0> <0, 8, 0> // lights spread out across this distance (x * y) //4, 4 // total number of lights in grid (4x*4z = 16 lights) 3, 3 // 9 lights adaptive 0 // 0,1,2,3... jitter // adds random softening of light circular // make the shape of the light circular orient // orient light translate <0, l_height*2, 10> // position of light } #end // ---------------------------------------- // Scene ---------------------------------- plane { y, 0 #if (show_floor) texture{t_3 finish{ambient 0.1}} #else texture{pigment{color rgb <0,0,0.2>}} #end } // A Sphere? #if(show_sphere) sphere{0,1 texture{t_mirror_purple scale 5} scale 2 translate <-3,2,5> } #end // ----------------------------------------