// A waterscape scene by Mike Andrews. // May 1999. //========================================= // macro mAlign // Adapted from Giles Trans' Maketree.pov //----------------------------------------- // returns a matrix operation that aligns an object or texture along P2-P1 // the object is translated to P1 // translate to P2-P1 if you want the object to be on P2 #macro mAlign(P1,P2) #local yV1=vnormalize(P2-P1); #local xV1=vnormalize(vcross(yV1,z)); #local zV1=vcross(xV1,yV1); matrix #end //----------------------------------------- // end of mAlign macro //========================================= #include "colors.inc" global_settings { assumed_gamma 1.0 max_trace_level 25 } #declare lightDir = vnormalize(<-0.5,2.5,4>); #declare lightLen = 1000000; #declare lightRad = lightLen*2*sin(radians(0.25)); #declare camPos = <0.0, .15, -.75>; #declare camLookAt = 0; #declare camAngle = 60; camera { up <0, 1, 0> right <4/3, 0, 0> location camPos direction <0.0, 0.0, 1> angle camAngle look_at camLookAt } light_source { 0*x colour rgb 1.0 translate lightDir*lightLen media_attenuation on } // fake atmospheric scattering ... union { sphere { 0, 1 pigment { rgb 1 } finish { ambient 3 diffuse 0 } } disc { 0, y, 1 pigment { spherical poly_wave 3 } finish { ambient 2 diffuse 0 } scale 15 } no_shadow scale lightRad mAlign(lightLen*lightDir, camPos) } #declare baseRad = 6371.0; #declare grndRad = baseRad; #declare atmsDepth = 200; #declare atmsScale = 8.4; #declare atmsRad = grndRad + atmsDepth; #declare cloudDepth = 1; #declare cloudBase = baseRad+2; #declare cloudTop = cloudBase + cloudDepth; // if Quick is false use scattering media, else use absorption/emission #declare Quick = true; #declare mSamples = 50; #declare atmDisp = sqrt(4); #declare atmCol = <1/atmDisp, 1, atmDisp>; #declare atmDensity = 0.01; // exponential decreasing atmospheric density sphere { 0, 1 pigment { rgbf 1 } finish { ambient 0 diffuse 0 } interior { media { intervals mSamples #if (Quick) absorption atmDensity emission (1+0.05*atmCol)*atmDensity #else scattering { 4, rgb atmDensity extinction 1 } emission 0.05*atmCol*atmDensity #end samples 2, sqrt(mSamples) confidence 0.9999 variance 1/1000 density { spherical frequency -1 colour_map { #declare maxCount = 20; #declare grndVal = grndRad/atmsRad; #declare baseVal = cloudBase/atmsRad; #declare topVal = cloudTop/atmsRad; [grndVal rgb 1] [baseVal rgb 0.5*(atmCol+2)] [topVal rgb atmCol] #declare Count = 1; #while (Count < maxCount) #declare curFrac = Count/maxCount; #declare curVal = (1-curFrac)*topVal + curFrac; #declare curCol = atmCol*exp(-curFrac*atmsDepth/atmsScale); [curVal rgb curCol] #declare Count = Count+1; #end [1 rgb 1] } } } } hollow scale atmsRad translate -baseRad*y } // ground sphere, Earth radius, water texture sphere { 0, grndRad texture { pigment { color rgb <80,90,94>/255.0 } finish { diffuse 0.2 ambient 0.05*<80,90,94>/94 reflection_max 1.0*<80,90,94>/94 reflection_min 0.4*<80,90,94>/94 reflection_exponent 0.5 specular 0.3 roughness 0.001 brilliance 0.01 metallic 0.5 } normal{ bozo normal_map { [ 0.00 waves 0.050 translate -0.5 rotate -132 scale 1000*baseRad frequency 500*baseRad] [ 0.70 ripples 0.025 translate -0.5 rotate 213 scale 1000*baseRad frequency 1000*baseRad] [ 0.85 waves 0.015 translate -0.5 rotate 23 scale 1000*baseRad frequency 1000*baseRad] [ 1.00 ripples 0.005 translate -0.5 rotate 73 scale 1000*baseRad frequency 2000*baseRad] } scale 1/100 scale 1/50 warp { turbulence 1/5 octaves 2 lambda 5 omega 1/5 } warp { turbulence -1/5 octaves 2 lambda 5 omega 1/5 } scale 50 } } translate -baseRad*y } // landscape height_field { pattern 600,600 { hf_gray_16 average pigment_map { [1 cylindrical cubic_wave scale 0.5 translate <0.5,0,0.5> scale 10 warp { turbulence 0.25 octaves 3 lambda 5 omega 1/5 } warp { turbulence 0.25 octaves 3 lambda 5 omega 1/5 } scale 1/10 colour_map { [0 rgb 0][0.4 rgb 1] } ] [1 cylindrical cubic_wave scale 0.5 translate <0.5,0,0.5> scale 10 warp { turbulence 0.25 octaves 3 lambda 5 omega 1/5 } warp { turbulence 0.25 octaves 3 lambda 5 omega 1/5 } scale 1/10 pigment_map { [0.41 rgb 0] [0.75 planar cubic_wave scale 2 translate -y #declare turbVal = 1/4; warp { turbulence turbVal octaves 3 lambda 3 omega 1/sqrt(3) } warp { turbulence turbVal octaves 3 lambda 3 omega 1/sqrt(3) } warp { turbulence turbVal octaves 3 lambda 3 omega 1/sqrt(3) } warp { turbulence turbVal octaves 3 lambda 3 omega 1/sqrt(3) } colour_map { [0.15 rgb 0.05][0.85 rgb 1] } scale 1/6 ] } ] } } smooth #declare landLevel = 0.92; texture { slope y texture_map { [landLevel-0.05 pigment { spotted frequency 4 colour_map{ [0.0 colour DarkBrown] [0.2 colour Gold] [0.2 colour Tan] [0.5 colour DarkBrown*0.7] [1.0 colour DarkBrown*1.2] } scale <4,20,4> warp { turbulence 1 } scale <10, 0.1, 10> rotate 23 scale 10/(<20,2,20>*2) } normal { granite 0.05 scale 0.15 } finish { diffuse 0.4 specular 0.3 ambient 0.1*DarkBrown brilliance 1 roughness 0.5 metallic reflection_max 0.4*DarkBrown reflection_min 0.1*DarkBrown } ] [landLevel pigment { colour DarkBrown*0.5 } normal { granite 0.2 scale 0.5 } finish { diffuse 0.4 specular 0.2 ambient 0.05*DarkBrown brilliance 0.1 roughness 0.1 metallic reflection_max 0.25*DarkBrown reflection_min 0.05*DarkBrown } ] [landLevel pigment { colour ForestGreen } normal { granite 0.1 scale 0.25 } finish { diffuse 0.7 ambient 0.2*ForestGreen reflection_max 0.6*ForestGreen reflection_min 0.2*ForestGreen } ] } } translate -0.5 scale <20,2,20>*2 translate sqrt(grndRad*grndRad-20*2*0.4*20*2*0.4)*y rotate x*degrees(atan2(20*2*0.5,grndRad)) translate -baseRad*y }