/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : Into the wild.pov (issued from: Iso_spline_test.pov) Version : 3.8 Description : Use of splines in isosurfaces Author : Thomas de Groot Date : July-August 2020 **********************************************************************************/ // Render settings (right-click on a line below): //+w640 +h640 +a0.3 +am2 +bm2 +bs8 +wt6 //+w1000 +h450 +a0.3 +am2 +bm2 +bs8 +wt6 //+w1000 +h450 +a0.3 +am3 +ac0.9 +ss2984 +bm2 +bs8 +wt6 #version 3.8; //-------------------------------------------------------------------------- #include "functions.inc" #include "math.inc" #include "transforms.inc" //-------------------------------------------------------------------------- global_settings { assumed_gamma 1.0 radiosity { pretrace_start 0.08 // start pretrace at this size pretrace_end 0.04 // end pretrace at this size count 100, 1000 // 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 1 // 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 off // take surface normals into account [off] media off // 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 } } //-------------------------------------------------------------------------- // camera ------------------------------------------------------------------ #declare CamPos = <-7.0 , 4.0 , -12.0>; #declare Camera_2 = camera { /*ultra_wide_angle*/ angle 75 //landscape view location CamPos right x*image_width/image_height look_at <0.0 , 3.0 , 0.0> } camera{Camera_2} //-------------------------------------------------------------------------- //Sky parameters: //-------------- #declare Sun_alt = 60; #declare Sun_azm = -90; #declare SunPos = vrotate(<0, 0, -1>*10e4, ); #declare SunDia = vlength(SunPos)*2/215; //apparent diameter of the Sun #declare Haze = on; #if (Haze) #declare SunCol2 = <1.0, 1.0, 1.0>*2; #else #declare SunCol2 = <1.0, 1.0, 1.0>*4; #end //-------------------------------------------------------------------------- #local SunObj = sphere {<0,0,0>, SunDia*10} //Sun of the landscape: #declare Sun2 = light_source { <0, 0, 0> color rgb SunCol2 translate SunPos //looks_like {SunObj} parallel point_at <0, 0, 0> } Sun2 //-------------------------------------------------------------------------- // sky --------------------------------------------------------------------- background {rgb 0.01} #declare Sky = sphere { <0, 0, 0>, 1 texture { pigment {rgb 0 transmit 1} finish {diffuse 0} } interior_texture { pigment { gradient y color_map { [0.0 srgbt <0.6, 0.7, 1.0, 0.25>] [0.5 srgbt <0.0, 0.1, 0.8, 0.25>] [1.0 srgbt <0.6, 0.7, 1.0, 0.25>] } scale 2 } finish {emission 1 diffuse 0} } scale 10e5 hollow no_shadow no_reflection } Sky //-------------------------------------------------------------------------- // haze -------------------------------------------------------------------- #if (Haze) #local HazeScale = 100; sphere {<0.0, 0.0, 0.0>, 1 texture {pigment {color rgbft 1}} hollow interior { media { scattering {1, srgb <0.90, 0.90, 0.91>*5/HazeScale} intervals 1 samples 20 method 3 density { spherical //granite color_map { [0.10 rgb 0.00] [1.00 rgb 1.00] } warp {turbulence <0.2, 0.2, 0.5>} scale HazeScale } } } scale HazeScale*<1,0.5,1> } #end //-------------------------------------------------------------------------- // ground ------------------------------------------------------------------ plane { <0, 1, 0>, 0 texture { pigment {checker color srgb <1, 1, 1>*0.99 color srgb <1, 1, 1>*0.95} finish {diffuse 0.1} scale 6 } } //-------------------------------------------------------------------------- //---------------------------- objects in scene ---------------------------- //-------------------------------------------------------------------------- #declare P_image = function { pigment { image_map {png "plasma3.png" gamma 1.0 map_type 0 interpolate 2 once } translate -0.5//<-0.5, -0.5, -0.5> rotate -90*x scale 24 } } #declare F1 = function {P_image(x, y, z).hf} //--------------------------------------------------------------------------- #declare F_spline = function { spline { natural_spline -2.00, < 1.0, 0, 0.00>, -1.00, < 1.0, 0, 0.00>, -0.50, < 0.8, 0, 0.10>, -0.25, < 0.5, 0, 0.25>, 0.00, < 0.1, 0,-0.50>, 0.25, < 0.5, 0, 0.25>, 0.50, < 0.8, 0, 0.10>, 1.00, < 1.0, 0, 0.00>, 2.00, < 1.0, 0, 0.00> } } #declare F2a = function {F_spline(x).x*2}; //vertical scaling #declare F2b = function {F_spline(z).z*2}; //idem //---------------------------- #declare F_spline2 = function { spline { natural_spline -1.00, <-1.00, 0.00, 0.00>, 0.00, <0.10, 0.00, 0.00>, 0.10, <0.15, 0.00, 0.20>, 0.50, <0.40, 0.00, 0.25>, 0.60, <0.50, 0.00, 0.30>, 0.70, <0.65, 0.00, 0.40>, 0.80, <0.70, 0.00, 0.45>, 0.90, <0.85, 0.00, 0.65>, 1.00, <0.90, 0.00, 0.70>, 2.00, <1.00, 0.00, 1.00> } } #declare F22a = function {F_spline2(x).x}; #declare F22b = function {F_spline2(z).z}; //--------------------------------------------------------------------------- #declare P_random = function { pigment { granite//bozo color_map { [0.0 rgb 0.0] [0.8 rgb 1.0] } scale 0.2 } } #declare F3a = function {P_random(x, y, z).red} #declare P_crack = function { pigment { bozo color_map { [0.0 rgb 0.0] [0.8 rgb 1.0] } scale 2 } } #declare P_granite = function { pigment { granite color_map { [0.0 rgb 0.0] [0.8 rgb 1.0] } scale 2 } } #declare F3b = function {P_crack(x, y, z).red - (P_granite(x, y, z).red)/2} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #declare P_veg1 = pigment { granite pigment_map { [0.20 srgb <0.5, 0.7, 0.2>] [0.80 srgb <0.8, 0.8, 0.3>] [0.95 srgb <0.8, 0.8, 0.3>] [0.95 srgb <1.0, 0.2, 0.1>] [0.99 srgb <0.5, 0.7, 0.2>] } scale 0.2 } #declare N_veg1 = normal { bozo 1 normal_map { [0.0 granite 5 scale 0.001] [1.0 bozo 1.0 scale 0.01] } warp {turbulence 0.4} } #declare P_veg2 = pigment { granite pigment_map { [0.20 srgb <0.5, 0.7, 0.2>] [0.80 srgb <0.2, 0.7, 0.1>] [0.95 srgb <0.2, 0.7, 0.1>] [0.95 srgb <1.0, 0.3, 0.1>] [1.00 srgb <0.5, 0.7, 0.2>] } scale 0.2 } #declare N_veg2 = normal { granite 1 normal_map { [0.0 bozo 0.8 scale 0.001] [1.0 granite 4 scale 0.1] } warp {turbulence 0.3} } #declare Slope1 = texture { slope { <0.0, -0.99, 0.0>, 0.0, 0.5 altitude <0.0, 0.01, 0.0>, 0.0, 1.0 } texture_map { [0.2 P_veg1 finish {diffuse 0.8 specular 0.3 roughness 0.001} normal {N_veg1}] [0.8 P_veg2 finish {diffuse 0.6 specular 0.2 roughness 0.001} normal {N_veg2}] } } #declare Slope2 = texture { slope { <0.0, -0.79, 0.0>, 0.0, 0.5 altitude <0.0, 0.21, 0.0>, 0.0, 1.0 } texture_map { [0.2 pigment {srgb <0.9, 0.8, 0.1>} finish {diffuse 0.8 specular 0.3 roughness 0.001} normal {N_veg2}] [0.7 pigment {srgb <0.8, 0.5, 0.2>} finish {diffuse 0.6 specular 0.2 roughness 0.001} normal {N_veg1}] } } #declare Slope3a = texture { slope { <0.0, -0.1, 0.0>, 0.0, 0.5 altitude <0.0, 0.9, 0.0>, 0.0, 6.5 } texture_map { [0.4 Slope1] [0.6 Slope2] } warp {turbulence <0.1, 0.8, 0.1>} } #declare Slope3b = texture { pigment_pattern {function {F3a(x*3, y*2, z*3)/10 - F3a(x*30, y*20, z*30)/10}} //same function as in the isosurface texture_map { [0.0 Slope1] [1.0 Slope3a] } } #declare T_rock = texture { pigment { granite pigment_map { [0.2 srgb <0.5, 0.5, 0.5>] [0.7 srgb <0.8, 0.7, 0.6>] } scale 0.5 } normal {granite 2 scale 0.01} finish {diffuse 0.7} } texture { pigment { bozo pigment_map { [0.4 srgbt <1, 1, 1, 1>] [0.6 srgbt <0.8, 0.8, 0.8, 0.5>] } scale 0.1 } normal {granite 1 scale 0.001} finish {diffuse 0.5} } //-------------------------------------------------------------- //a combination texture: #declare T_landscape = texture { slope { <0.0, -0.8, 0.0>, 0.0, 0.5 altitude <0.0, 0.2, 0.0> 0.0, 6.5 } texture_map { [0.1 Slope3b] [0.9 T_rock] } } //-------------------------------------------------------------- //Two landscape isosurfaces. You can comment/uncomment Isoveg or Isorock: #declare Isoveg = isosurface { function { y - F1(x, 0, z) //image function ("landscape") - f_noise3d(x*2, y/10, z*2) //generates "pancakes" with y*15 - (F2a(x/10, y, z) //x-spline with horizontal scaling - F2b(x, y, z/10) ) //z-spline with idem - (F22a(x/2, y, z) //"terrasse" x-spline + F22b(x, y, z/2) ) //"terrasse" z-spline + (F3a(x*3, y*2, z*3)/10 //"vegetation" - F3a(x*30, y*20, z*30)/10 ) //"vegetation" } contained_by {box {<-24, -3, -24>, <24, 6, 24>}} threshold 0 accuracy 0.001 max_gradient 100 #local Min_factor=0.6; //evaluate 2000*Min_factor, sqrt(2000/(2000*Min_factor)), 0.7 texture {Slope3b} //or: //texture {pigment {rgb 1.0} finish {diffuse 0.5}} translate 2*y } //Isoveg #declare Isorock = isosurface { function { y - F1(x, 0, z) //image function ("landscape") - f_noise3d(x*2, y/10, z*2) //generates "pancakes" with y*15 - (F2a(x/10, y, z) //x-spline with horizontal scaling - F2b(x, y, z/10) ) //z-spline with idem - (F22a(x/2, y, z) //"terrasse" x-spline + F22b(x, y, z/2) ) //"terrasse" z-spline + (F3b(x*2, y, z*2)/10 - F3b(x*5, y*2, z*5)/10 ) } contained_by {box {<-24, -3, -24>, <24, 6, 24>}} threshold 0 accuracy 0.001 max_gradient 100 #local Min_factor=0.6; //evaluate 2000*Min_factor, sqrt(2000/(2000*Min_factor)), 0.7 //texture {T_rock} //or: texture {T_landscape} //or: //texture {pigment {rgb 0.5} finish {diffuse 0.5}} translate 2*y } Isorock //--------------------------------------------------