//*********************************************************************************** // Polyheart David VanHorn December 2006 // http://www.polyamory.org/ // //*********************************************************************************** // Scene options // These interact in some cases, see below. // //#declare TestSpheres = 1; // Spheres only, for checking textures //#declare NoHeart = 1; // Turns off heart AND bounding box //#declare SolidHeart = 1; // Otherwise a hollow one. //#declare NoInf = 1; // Turns off infinity symbol //#declare NoRefl = 1; // Turns off the image plane behind the camera #declare GoldPlane = 1; // Uses a gold plane for highlights instead of an image #declare PhongOff = 1; // Turns off phong reflection on the glass material. #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" //#include "functions.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 40 ambient_light < 0.16, 0.16, 0.20> #ifndef (NO_Radiosity) radiosity { error_bound 1.8 // higher -> smoother, less accurate [1.8] #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 // always_sample on // 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 // always_sample off // 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.0025 // 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 10 // 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 2.5 caustics 1.0 } //************************************************************************************** // Textures // // #declare Glass = texture { pigment { rgbf <0.98, 1.0, 0.99, 0.99> } finish { ambient 0.0 //0.10 // As if from scattered light in the scene diffuse 0.0 //0.10 // reflections from light sources brilliance 0.0 // higher makes more metallic appearance #ifndef (Phong_Off) phong 1.0 phong_size 50 // higher = more polished metallic 0.5 // 0 - 1 #end reflection { .01 // mirror-like quality , min max fresnel on metallic 0 // 0-> 1 } specular 0.25 //Similar to phong, all over the surface // too much spec looks like pool balls roughness .02 //This gives a nice shine, 0.00005 - 1.0 (rough) conserve_energy } } // Ruby glass #declare Ruby_Glass = texture { Glass pigment { Col_Ruby_06 } } // Saphire glass #declare Saph_Glass = texture { Glass pigment { Col_Sapphire_06 } } //************************************************************************************* // 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! // #ifndef (NoHeart) // So I can turn off just the heart #declare Bend=0.45; #declare Sharpness=0.8; #include "functions.inc" //Needed for f_torus and F_sphere #ifndef (SolidHeart) #declare Heart_Function = function { f_torus (y-pow(abs(x),Sharpness)*Bend, z*1, x, 0.8,0.1) } #else #declare Heart_Function = function { f_sphere (y-pow(abs(x),Sharpness)*Bend, z*2, x, 0.6 ) } #end //The heart shape and bounding box #declare Heart = isosurface { function { Heart_Function (x, y, z) } accuracy 0.0125 // Make this as small as needed for good render, and no smaller //max_trace 1 // 1 if solid //max_trace 3 // 3 for simple glass all_intersections // Or use this for max quality in a transparent #ifndef (SolidHeart) //f_torus version max_gradient 1.7 // Pov reports 1.637 used, and we want to be > that contained_by { sphere { 0,1.5}} #else //f_sphere version max_gradient 2.0 contained_by { sphere { 0,1 } } #end } //finally, the heart as an object #declare MyHeart = object { Heart material { M_Ruby_Glass } #ifndef(NoPhotons) photons { collect on refraction on reflection on target 1.0 } #end } #end // NoHeart //************************************************************************************** // 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 on refraction on reflection on target 1.0 } #end } //Within that, a second one in gold /* object { sphere_sweep { b_spline 9, <-2, -1, 0>, 0.05, < 0, 0, 0>, 0.03, < 2, 1, 0>, 0.05, < 2, -1, 0>, 0.05, < 0, 0, 0>, 0.03, <-2, 1, 0>, 0.05, <-2, -1, 0>, 0.05, < 0, 0, 0>, 0.03, < 2, 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" object { Mobius(<1,0.5>,0.1,0.01,<6,50>,1,45,1,1) material { M_Ruby_Glass } } #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 } } #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 } } #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 < 40.00, 0.00, 0.00> scale < 2.00, 2.00, 2.00> // translate < 0.00, 0.50, 0.00> // 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 < 2.50, 2.50, 2.50> 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 <10, 8, 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 K = 256; #declare Gold_Drop = rgb < 241, 130, 0 >/K; #declare Gold_Tips = rgb < 222, 186, 19 >/K; #declare Golden_Bell = rgb < 226, 137, 19 >/K; #declare Golden_Dream = rgb < 240, 213, 45 >/K; #declare Golden_Fizz = rgb < 245, 251, 61 >/K; #declare Golden_Glow = rgb < 253, 226, 149 >/K; #declare Golden_Sand = rgb < 240, 219, 125 >/K; #declare Golden_Tainoi = rgb < 255, 204, 92 >/K; #declare Bigness = 8000000; object { box { <0,0,0> <1,1,1> //Have to do it this way, the image paints from 0 to 1 pigment { #ifndef (GoldPlane) image_map {jpeg "lovers.jpg"} //Need to work on this. #else Gold_Drop #end } } translate <-0.5, -0.5, -0.5> //re-center at 0,0,0 scale //Ready for the big screen? translate <2000,-9000, -40000> //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 60 //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 1.0 // Smaller values put more in focus blur_samples 50 // Less samples is faster, lower quality focal_point <0,0,0> // Always in focus confidence 0.99 // 0->1 larger is better variance 1/256 // Stops calculation when the result won't matter anymore #end }