//*********************************************************************************** // 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 //#declare Checkers = 1; #declare NoMobius = 1; // Turns off mobius strip // //*********************************************************************************** // 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" // // //mobius.inc is used IF mobius is not disabled // //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 1000000 // 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>; //************************************************************************************* // Interiors // #declare Glass_Interior = interior { ior 1.5 caustics 1.0 } //************************************************************************************** // Textures // // Glass textures contributed by Norm Bowler, of Richland WA #declare NBglass = texture { pigment { rgbf <0.98, 1.0, 0.99, 0.75> } finish { ambient 0.1 diffuse 0.1 reflection .25 specular 1 roughness .001 conserve_energy } } // A few color variations on Norm's glass // Ruby glass #declare Ruby_Glass = texture { NBglass pigment { rgbf <0.9, 0.1, 0.2, 0.8> } } // A few color variations on Norm's glass // Saphire glass #declare Saph_Glass = texture { NBglass pigment { rgbf <0.1, 0.2, 0.9, 0.8> } } //************************************************************************************* // Materials // #declare M_Ruby_Glass = material { texture {Ruby_Glass} interior {Glass_Interior} } #declare M_Saph_Glass = material { texture {Saph_Glass} interior {Glass_Interior} } //************************************************************************************** // 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 material { M_Ruby_Glass } #ifndef(NoPhotons) photons { collect off refraction on reflection on target 1.0 } #end } //************************************************************************************** // The infinity shape // DONT scale/translate/rotate here! // #ifndef (NoInf) //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 } material { M_Saph_Glass } #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 } */ } } #end //*********************************************************************************** // Mobius strip #ifndef (NoMobius) #include "mobius.inc" #declare MyGlass=material{ texture{ Ruby_Tex } interior{ I_Glass1 }} object{Mobius(<2,1>,0.1,0.01,<6,50>,1,45,1,1) material{MyGlass}} #end // syntax: Mobius(Ax,d,s,nR,SA,SM,UV,RE) // Ax = half-length of x-axis and z axis // d = Width/thickness of strip (centred on N.A.) // s = # segments in circumference (m), width (n) & // thickness (o) // nR = # half-twists of the strip (0=no twist, 1=180deg, etc) // (negative #s will reverse the direction of the twist) // SA = angle of twisting at +x axis // SM = smoothing (yes/no) // UV = uv_mapping (yes/no) // RE = round edges (yes/no) // // ex: // object{Mobius(<20,10>,4,2,<6,50>,1,45,yes,yes,yes) material{MyMat}} // // creates a smooth mobius 40x20 units in size, 4 units wide, 2 units // thick with one twist (traditional mobius) and round edges. The twist // starts at 45° on the +x axis. There are 6 mesh segments in the width // and 50 around the circumference of the mobius. // Using uv_mapping: The mesh uses a texture defined from <0,0,0> to // <2,2,0>. The top and bottom faces use the texture // from <0,0,0> to <1,2,0> and the side faces use the // texture from <1,2,0> to <2,2,0>. If there is an // odd number of twists, there is only one face, and // the texture will run smoothly around the entire // face. With an even number of twists, the texture // will be split between the top and bottom faces and // likewise for the sides. // //*********************************************************************************** // Test spheres for textures // Each is one unit radius #declare WhiteSphere = object { sphere { <0,0,0> 1 texture { pigment { color rgb <1,1,1> }} #ifndef(NoPhotons) photons { collect on refraction off reflection off target 1.0 } #end } } #declare RedSphere = object { sphere { <0,0,0> 1 material { M_Ruby_Glass } //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 material { M_Saph_Glass } //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) #ifndef (Checkers) #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 } #else // create a box that extends between the 2 specified points object {box { <-0.5, -0.5, -0.5> // one corner position < 0.5, 0.5, 0.5> // other corner position } pigment { checker pigment{rgb <1,1,1>}, pigment{rgb <0,0,0>} scale <0.1, 0.1, 0.1> } translate <0,0,1> } #end #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 1 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 50 //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 }