// Persistence of Vision Ray Tracer Scene Description File // File: Wet.pov // Vers: 3.5 // Desc: Wet // Date: 2001-12-04 // Auth: Sven Heinzel // #version 3.5; #include "colors.inc" #include "woods.inc" #include "metals.inc" #include "skies.inc" #include "functions.inc" #include "rand.inc" #declare TEST = 0; #declare PHOTONS = 1; #declare RADIOSITY = 1; #declare AMBIENT = 0; #declare SKY = 1; #declare LIGHT = 1; #declare NORMAL = 1; #declare ISOGROUND = 1; #declare FOG = 0; #declare BLOB = 1; #declare DISPERSION = 1; #declare DISPERSION_SAMPLES = 16; #declare FOCAL = 0; #declare FOCAL_SAMPLES = 20; #declare AREALIGHT = 1; #declare AREALIGHT_WIDTH = 10; #declare AREALIGHT_RES = 8; /************************** * GENERAL SCENE SETTINGS **************************/ // Global settings global_settings { assumed_gamma 1 #if(!AMBIENT) ambient_light rgb<0, 0, 0> #end #if(TEST) max_trace_level 4 #else max_trace_level 10 #end #if(PHOTONS) photons { count 2000000 autostop 0 #if(FOG) media on #end } #end #if(RADIOSITY) radiosity { pretrace_start 0.1 pretrace_end 0.01 brightness 1.0 gray_threshold 0.5 count 200 recursion_limit 3 nearest_count 10 error_bound 0.5 always_sample off #if(FOG) media on #end #if(NORMAL) normal on #end } #end } // Default ambient #default { texture { finish { #if(AMBIENT) ambient 0.3 #else ambient 0 #end } } finish { #if(AMBIENT) ambient 0.3 #else ambient 0 #end } } // The sky #if(SKY) sky_sphere { S_Cloud4 } #end /************************** * GLOBAL FUNCTIONS **************************/ // 3.5 beta 8 error workaround #declare foo=function{0} // Grainy look #declare g_grainfunc = function { #declare g_grain = pigment { granite scale 1 turbulence 0.5 } pigment { g_grain } } // Scratchy look #declare g_scratchfunc = function { #declare g_scratch = pigment { onion scale 0.08 turbulence 0.5 } pigment { g_scratch } } // Wood look #declare g_woodfunc = function { #declare g_wood = pigment { P_WoodGrain12B color_map { M_Wood18B } scale 1.5 rotate <-25, 10, 8> } pigment { g_wood } } /************************** * MATERIALS **************************/ // Wood material polished #declare M_Wood_Polish = material { texture { T_Wood7 scale 0.4 rotate <-5, 10, 8> #if(NORMAL) normal { function {g_grainfunc(x*15, y*15, z*15).gray * 0.2} } #end finish { specular 0.5 roughness 0.002 diffuse 0.2 conserve_energy reflection 0.2 } } } // Wood material rough #declare M_Wood_Rough = material { #local l_woodnormal = normal { #if(!ISOGROUND) function {g_grainfunc(x*15, y*15, z*15).gray * 0.2 + g_woodfunc(x, y, z).gray * 10} #else function {g_grainfunc(x*15, y*15, z*15).gray * 0.2} #end } #local l_woodfinish = finish { //specular 0.1 //roughness 0.2 diffuse 0.7 } texture { #if(NORMAL) normal { l_woodnormal } #end pigment { rgb <0.69, 0.42, 0.11> * 0.2 } finish { l_woodfinish } } texture { #if(NORMAL) normal { l_woodnormal } #end pigment { g_wood } finish { l_woodfinish } } texture { #if (NORMAL) normal { l_woodnormal } #end pigment { function { g_grainfunc(x*5, y*5, z*5).gray } color_map { [0.0 rgbt <0.10, 0.10, 0.15, 1.00>] [1.0 rgbt <0.15, 0.15, 0.20, 0.70>] } } finish { l_woodfinish } } } // Water material #declare M_Water = material { texture { pigment { rgbt <0.95, 0.95, 0.95, 0.95> } finish { specular 0.9 roughness 0.01 diffuse 0.05 conserve_energy reflection { 0.01, 0.9 fresnel on } } } interior { #if(DISPERSION) dispersion Water_Dispersion dispersion_samples DISPERSION_SAMPLES #end ior Water_Ior } } // Glass material #declare M_Glass = material { texture { pigment { rgbt <0.95, 0.98, 0.96, 0.95> } #if(NORMAL) normal { function {g_grainfunc(x*50, y*50, z*50).gray * 0.01} } #end finish { specular 0.6 roughness 0.005 diffuse 0.05 conserve_energy reflection { 0.1, 1.0 fresnel on } } } interior { #if(DISPERSION) dispersion Quartz_Glass_Dispersion dispersion_samples DISPERSION_SAMPLES #end ior Quartz_Glass_Ior fade_power 1001 fade_distance 0.9 fade_color <0.5, 0.8, 0.6> } } // Metal material #declare M_Metal = material { texture { T_Chrome_4C #if(NORMAL) normal { function {g_grainfunc(x*0.1, y*50, z*0.1).gray * 0.02 + g_grainfunc(x*50, y*50, z*50).gray * 0.01} } #end } } // Plastic material rough #declare M_RedPlastic_Rough = material { #local l_plasticfinish = finish { specular 0.07 roughness 0.05 brilliance 2 diffuse 0.9 } #local l_plasticnormal = normal { function {g_grainfunc(x*35, y*35, z*35).gray * 0.04} } texture { #if (NORMAL) normal { l_plasticnormal } #end pigment { Red } finish { l_plasticfinish } } texture { #if (NORMAL) normal { l_plasticnormal } #end pigment { function { g_grainfunc(x*15, y*15, z*15).gray } color_map { [0.0 rgbt <0.10, 0.10, 0.15, 1.00>] [1.0 rgbt <0.15, 0.15, 0.20, 0.85>] } } finish { l_plasticfinish } } } /************************** * MACROS **************************/ // Ring macro #macro Ring(RadA, RadB, Height) difference { cylinder { <0, -Height/2, 0>, <0, Height/2, 0>, RadA + RadB } cylinder { <0, -Height, 0>, <0, Height, 0>, RadA - RadB } } #end // Rounded ring macro #macro Round_Ring(RadA, RadB, Height, RadRound) merge { Ring(RadA, RadB, Height - RadRound*2) Ring(RadA, RadB - RadRound, Height) // Outer tori torus { RadA + RadB - RadRound, RadRound translate y * (Height/2 - RadRound) } torus { RadA + RadB - RadRound, RadRound translate y * -(Height/2 - RadRound) } // Inner tori torus { RadA - RadB + RadRound, RadRound translate y * (Height/2 - RadRound) } torus { RadA - RadB + RadRound, RadRound translate y * -(Height/2 - RadRound) } } #end // Grooved rounded ring macro #macro Grooved_Round_Ring(RadA, RadB, Height, RadRound, GrooveDelta, GrooveHeight, GrooveDepth, GrooveRound) union { difference { Round_Ring(RadA, RadB, Height, RadRound) // Upper groove merge { Round_Ring(RadA + RadB, GrooveDepth, GrooveHeight, GrooveRound) Ring(RadA + RadB, GrooveRound, GrooveHeight + GrooveRound*2) translate y * (Height/2 - GrooveHeight/2 - GrooveDelta) } // Lower groove merge { Round_Ring(RadA + RadB, GrooveDepth, GrooveHeight, GrooveRound) Ring(RadA + RadB, GrooveRound, GrooveHeight + GrooveRound*2) translate y * -(Height/2 - GrooveHeight/2 - GrooveDelta) } } // Upper tori torus { RadA + RadB - GrooveRound, GrooveRound translate y * (Height/2 - GrooveDelta + GrooveRound) } torus { RadA + RadB - GrooveRound, GrooveRound translate y * (Height/2 - GrooveDelta - GrooveHeight - GrooveRound) } // Lower tori torus { RadA + RadB - GrooveRound, GrooveRound translate y * -(Height/2 - GrooveDelta + GrooveRound) } torus { RadA + RadB - GrooveRound, GrooveRound translate y * -(Height/2 - GrooveDelta - GrooveHeight - GrooveRound) } } #end /************************** * THE SCENE **************************/ // Camera camera { right x*image_width/image_height #if(1) // normal location <-4.5, 5.5, -4.5> look_at <0.0, 0.2, 0.0> #else // top location <0.0, 10, 0.0> look_at <0.0, 0.0, 0.0> #end #if(FOCAL) focal_point <0.0, 0.2, 0.0> aperture 0.4 blur_samples FOCAL_SAMPLES #end angle 30 } // Light #if(LIGHT) light_source { <50, 50, 15> rgb <0.95, 0.9, 0.85>*1.5 parallel point_at 0 #if(AREALIGHT) area_light x*AREALIGHT_WIDTH, z*AREALIGHT_WIDTH, AREALIGHT_RES, AREALIGHT_RES orient circular adaptive 1 jitter #end #if(FOG) media_interaction on media_attenuation on #end #if(PHOTONS) photons { reflection on refraction on #if(AREALIGHT) //area_light #end } #end } #end // Ground plane #if(!ISOGROUND) plane { y, 0 material { M_Wood_Rough } } #else isosurface { function { y - g_woodfunc(x, 0, z).gray * 0.2 } max_gradient 12 accuracy 0.0001 contained_by { box { <-1000, -1, -1000>, <1000, 0.1, 1000> } } translate y * -0.07 material { M_Wood_Rough } } #end // The fog #if(FOG) sphere { 0, 1 hollow pigment { rgbt 1 } interior { media { density { rgb <0.8, 0.8, 0.8> } scattering { 1, <0.2, 0.2, 0.2> } } } scale 1000 } #end // The ring #declare Ring_Rad = 0.8; #declare Ring_Thick = 0.1; #declare Ring_Height = 0.6; #declare O_Ring = Grooved_Round_Ring(Ring_Rad - Ring_Thick/2, // RadA Ring_Thick/2, // RadB Ring_Height, // Height Ring_Rad*0.01, // RadRound Ring_Height*0.15, // GrooveDelta Ring_Height*0.15, // GrooveHeight Ring_Thick*0.3, // GrooveDepth Ring_Rad*0.01) // GrooveRound object { O_Ring material { M_Metal } translate <0.5, Ring_Height/2, -1> #if(PHOTONS) photons { target refraction on reflection on //collect off } #end } // The sphere sphere { <0, 0.4, 0>, 0.4 translate <-1.0, 0, 1.2> material { M_Metal } #if(PHOTONS) photons { target refraction on reflection on //collect off } #end } // The blobs #macro VRand_On_Obj(Obj, RS) #local Mn = min_extent(Obj); #local Mx = max_extent(Obj); #local Pta = VRand_On_Sphere(RS) * vlength(Mx - Mn) + (Mx + Mn) / 2; #local J = 0; #local Norm = <0, 0, 0,>; #while(vlength(Norm) = 0 & J < 100000) #local Ptb = VRand_In_Obj(Obj, RS); #local Pt = trace (Obj, Ptb, Pta, Norm); #local J = J + 1; #end (Pt) #end #if(BLOB) // On the sphere blob { threshold 1 #declare rseed = seed(1234); #local i = 3000; #while(i >= 0) sphere { VRand_On_Sphere(rseed), RRand(rseed, 0.04, 0.06), 0.9 } #local i = i - 1; #end scale 0.4 translate <-1.0, 0.4, 1.2> material { M_Water } #if(PHOTONS) photons { target 0.5 refraction on reflection on collect off } #end } // On the ring blob { threshold 1 #declare rseed = seed(1234); #local i = 8000; #while(i >= 0) sphere { VRand_On_Obj(O_Ring, rseed), RRand(rseed, 0.015, 0.025), 0.9 } #local i = i - 1; #end translate <0.5, Ring_Height/2, -1> material { M_Water } #if(PHOTONS) photons { target 0.5 refraction on reflection on collect off } #end } #end