//*********************************************************************************** // Polyheart David VanHorn December 2006 // http://www.polyamory.org/ // //*********************************************************************************** // Scene options // //#declare TestSpheres = 1; // Spheres only, for checking textures //#declare NoHeart = 1; // Turns off heart AND bounding box //#declare NoInf = 1; // Turns off infinity symbol //#declare NoRefl = 1; // Turns off the image plane behind the camera #declare NoVelvet = 1; // Turns off velvet under the glass // //*********************************************************************************** // Quality options // //#declare LowRadiosity = 1; // Faster render //#declare NO_Radiosity = 1; // MUCH faster //#declare NoPhotons = 1; // Faster render //#declare NoBlur = 1; // Faster render // //********************************************************************************** // External files // //#include "colors.inc" //#include "realskies.inc" //#include "skies.inc" //#include "textures.inc" // Standard Texture definitions //#include "golds.inc" //#include "mobius.inc" // //cvelvet.inc is also used, but MUST be included below // //********************************************************************************** global_settings { assumed_gamma 1.0 max_trace_level 10 ambient_light <0.2,0.2,0.2> #ifndef (NO_Radiosity) radiosity { pretrace_start 1.0 // start pretrace at this size pretrace_end 0.005 // end pretrace at this size error_bound 1.8 // higher -> smoother, less accurate [1.8] recursion_limit 5 // how much interreflections are calculated (1..5+) [3] #ifndef (LowRadiosity) //High quality settings pretrace_start 1.0 // start pretrace at this size pretrace_end 0.0005 // end pretrace at this size count 500 // higher -> higher quality (1..1600) [35] nearest_count 10 // higher -> higher quality (1..20) [5] low_error_factor .2 // reduce error_bound during last pretrace step gray_threshold 0.0 // increase for weakening colors (0..1) [0] recursion_limit 6 // how much interreflections are calculated (1..5+) [3] adc_bailout 1/256 normal on // take surface normals into account [off] media on // take media into account [off] #else //Low quality settings pretrace_start 0.25 // start pretrace at this size pretrace_end 0.0015 // end pretrace at this size count 20 // higher -> higher quality (1..1600) [35] nearest_count 5 // higher -> higher quality (1..20) [5] low_error_factor .6 // reduce error_bound during last pretrace step gray_threshold 0.0 // increase for weakening colors (0..1) [0] recursion_limit 3 // how much interreflections are calculated (1..5+) [3] adc_bailout 1/64 normal on // take surface normals into account [off] media on // take media into account [off] #end minimum_reuse 0.015 // reuse of old radiosity samples [0.015] brightness 1 // brightness of radiosity effects (0..1) [1] max_sample 1.0 // maximum brightness of samples } #end // adding a photon{} block to global_settings activates photon mapping. // photons also need to be adjusted for light sources and objects. #ifndef (NoPhotons) photons { //spacing 0.025 // specify the density of photons count 100000 // alternatively use a total number of photons gather 20,100 // amount of photons gathered during render [20, 100] //media 5,2 // media photons jitter 1.0 // jitter photon rays max_trace_level 4 // optional separate max_trace_level #ifndef (LowRadiosity) adc_bailout 1/256 // see global adc_bailout #else adc_bailout 1/64 #end autostop 0 // photon autostop option //radius 10 // manually specified search radius // (---Adaptive Search Radius---) //steps 1 //expand_thresholds 0.2, 40 } #end noise_generator 3 #ifndef (LowRadiosity) adc_bailout 1/256 #else adc_bailout 1/64 #end } //************************************************************************************* // Colors // // Modified somewhat from colors.inc versions // #declare Col_Sapphire_06 = color rgbf <0.0784, 0.1706, 1.0000, 0.99>; #declare Col_Ruby_06 = color rgbf <1.0000, 0.1706, 0.0784, 0.99>; //************************************************************************************* // Finishes // #declare F_Glass5 = finish { specular 0.0125 roughness 0.005 //ambient 1.00 //diffuse 1.00 reflection { 0.005, 0.3 fresnel on } conserve_energy // } #declare I_Glass1 = interior { ior 2.4 caustics 1.0 //dispersion 1.1 //dispersion_samples 70 //2-100 } //************************************************************************************** // Textures // #declare Saphire_Tex = texture { pigment { Col_Sapphire_06 } finish { F_Glass5 } } #declare Ruby_Tex = texture { pigment { Col_Ruby_06 } finish { F_Glass5 } } //************************************************************************************** // The Heart Shape // DONT scale/translate/rotate here! // //The function #declare Heart_Function = function (x, y, z) { pow ( ( 2 * pow ( z, 2 ) + pow ( x, 2 ) + pow ( y, 2 ) -1 ), 3 ) - ( 0.1 * pow ( z, 2 ) + pow (x, 2 ) ) * pow ( y, 3 ) } //The heart shape and bounding box #declare Heart = isosurface { function { Heart_Function (x, y, z) } accuracy 0.000025 // Less than this shows a cutline across the middle. max_trace 1 // 1 if solid //max_trace 3 // 3 for simple glass //all_intersections // Or use this for max quality in a transparent max_gradient 101 // Pov reports 100 used, and we want to be > that //This box wants to be JUST larger than the iso //When testing, make this a little bigger, then adjust the test //box in the scene so that it's just larger and hides the heart //then pull the dims back up here. //Set the background to 0.5 so you can see the heart edges duting //the test. A succesful test is a grey box, with NO heart edges //Bump the result by 0.001 before entering here. contained_by { box { < 1.046, 1.20, 0.721 >, -< 1.046, 0.900, 0.721 > }} } //finally, the heart as an object #declare MyHeart = object { Heart texture { Ruby_Tex } interior { I_Glass1 } #ifndef(NoPhotons) photons { collect off refraction on reflection on target 1.0 } #end } //************************************************************************************** // The infinity shape // DONT scale/translate/rotate here! // //Saphire infinity #declare Infinity = object { union { object { sphere_sweep { b_spline 9, <-2, -1, 0>, 0.15, < 0, 0, 0>, 0.10, < 2, 1, 0>, 0.15, < 2, -1, 0>, 0.15, < 0, 0, 0>, 0.10, <-2, 1, 0>, 0.15, <-2, -1, 0>, 0.15, < 0, 0, 0>, 0.10, < 2, 1, 0>, 0.15 } texture { Saphire_Tex } interior { I_Glass1 } #ifndef(NoPhotons) photons { collect off refraction on reflection on target 1.0 } #end } //Within that, a second one in gold /* object { sphere_sweep { b_spline 9, <-1, -1, 0>, 0.05, < 0, 0, 0>, 0.03, < 1, 1, 0>, 0.05, < 1, -1, 0>, 0.05, < 0, 0, 0>, 0.03, <-1, 1, 0>, 0.05, <-1, -1, 0>, 0.05, < 0, 0, 0>, 0.03, < 1, 1, 0>, 0.05 } texture { T_Gold_5E } finish { F_MetalE } #ifndef(NoPhotons) photons { collect on refraction on reflection on target 1.0 } #end } */ } } //*********************************************************************************** // Test spheres for textures // Each is one unit radius #declare WhiteSphere = object { sphere { <0,0,0> 1 texture { pigment { color rgb <1,1,1> }} finish {F_Glass5} #ifndef(NoPhotons) photons { collect on refraction off reflection off target 1.0 } #end } } #declare RedSphere = object { sphere { <0,0,0> 1 texture { Ruby_Tex } interior { I_Glass1 } } #ifndef(NoPhotons) photons { collect off refraction on reflection on target 1.0 } #end } #declare BlueSphere = object { sphere { <0,0,0> 1 texture { Saphire_Tex } interior { I_Glass1 } } #ifndef(NoPhotons) photons { collect off refraction on reflection on target 1.0 } #end } //************************************************************************************* // The Scene // #ifndef (TestSpheres) // turn off the real bits, use test spheres #ifndef (NoInf) // So I can turn off just the infinity object { Infinity rotate < 0.00, 0.00, 0.00> scale < 1.00, 1.00, 1.00> // translate < 0.00, 0.50,-0.25> // Positioning relative to the heart, at 0,0,0 } #end #ifndef (NoHeart) // So I can turn off just the heart object { MyHeart rotate < 0.00, 0.00, 0.00> scale < 1.25, 1.25, 1.00> // I like it a little wider than generated translate < 0.00, 0.00, 0.00> } #end //For verifying the bounding box sixe, move the box size, and NOT the scaling up. //Normally, LEAVE THIS OFF! //left top back right bot front //object { box { < 1.046, 1.151, 0.721 >, -< 1.046, 0.900, 0.721 > } // texture { pigment { color rgb <1,1,1>}} // scale <1.25, 1.00, 1.00> // <<-- THIS MUST MATCH SCALING ON THE HEART ABOVE! // } #else //TestSpheres //Pull in the test spheres at 0 object { WhiteSphere translate < 0, 0, 0> } object { RedSphere translate <-2, 0, 0> } //left object { BlueSphere translate < 2, 0, 0> } //right #end //Velvet background for the glass #ifndef (NoVelvet) #declare Vb = 0.05; // Color Brightness [ > 0 to 2 ? ] #declare Vt = 0.50; // Velvet Thickness [ 0 to 3 ? ] #declare Vs = 0.10; // Velvet Size [ 0 to 6 ? ] #declare Vc = 1; // Color Choice [ 1= black, 2= red, 3= green, 4= blue ] #include "cvelvet.inc" // has to be included here, so the choices work box { <-0.5, -0.5, -0.5> < 0.5, 0.5, 0.5>// Plane at origin, in the X and Y directions, pointing back at me scale <8, 6, 1> texture { CVelvet } #ifndef(NoPhotons) photons { collect on //Slows things down a lot refraction on // reflection on // target 1.0 } #end translate <0,0,1> //just puts it past the glass stuff } #end //WAY behind the camera, a checkered plane to reflect in the glass #ifndef (NoRefl) #declare Bigness = 20000; object { box { <0,0,0> <1,1,1> //Have to do it this way, the image paints from 0 to 1 pigment { image_map {jpeg "lovers.jpg"} //Need to work on this. } } translate <-0.5, -0.5, -0.5> //re-center at 0,0,0 scale //Ready for the big screen? translate <2000,-9000, -10000> //just puts it way behind the camera } #end //************************************************************************************* // The Stage //The last thing you see, the edge of space background { color <0.0,0.0,0.0> }// color at horizon // // Lights, // light_source { < 0, 0, 0 > color rgb 5 media_attenuation on #ifndef (NoPhotons) photons { refraction on reflection on } #end translate < 0,0,-1000 > // behind the camera rotate x * 45 // gives elevation off horizon plane + = up rotate y * 30 // gives position + = clockwise when viewed from the top } // // Camera // camera { //perspective angle 35 //degrees direction < 0.0, 0.0, 1.0> //L-R, U-D, Away-Close location < 0.0, 0.0,-8.0> //L-R, U-D, Away-Close look_at < 0.0, 0.0, 0.0> //L-R, U-D, Away-Close right 4/3*x // Sets aspect ratio of image sky y // up y // Orients camera "UP" within the scene. #ifndef (NoBlur) aperture 0.6 // Smaller values put more in focus blur_samples 10 // Less samples is faster, lower quality focal_point <0,0,0> // Always in focus confidence 0.95 // 0->1 larger is better variance 1/256 // Stops calculation when the result won't matter anymore #end }