//bliss //a pov reconstruction of the XP backdrop //by tek #include "functions.inc" #include "rad_def.inc" #include "transforms.inc" #declare gboGrass = on; #declare gboRad = off; //I prefer it with radiosity off, because I'm too impatient to render it with it on! global_settings { max_trace_level 100 assumed_gamma 1 #if (gboRad) radiosity { Rad_Settings( Radiosity_Fast, on, on ) } #end } #default { pigment { rgb 1 } finish { ambient 0 diffuse 1 } } //the main hill, a very smooth curved shape #macro m_Y(fY) (vPos + fY*y) #if ( vPos.x < .9 ) #declare vPos = vPos + 0.333*x; #else #declare vPos = vPos*z - 0.333*z; #end #end #declare oHill = bicubic_patch { #declare vPos = <0,0,1>; type 1 u_steps 8 v_steps 8 //interesting pov bug, it throws an error without the <0,0,0> on there! <0,0,0> + m_Y(.08), m_Y(.16), m_Y(.06), m_Y(0), m_Y(.08), m_Y(.16), m_Y(0), m_Y(0), m_Y(0), m_Y(0), m_Y(-.08), m_Y(-.05), m_Y(-.05), m_Y(0), m_Y(0), m_Y(.05) //pigment { checker rgb .3, rgb 1 translate -.5*y scale .25+y*1000 } //debug //pigment { rgb <.05,.01,.0> } //earth pigment { spotted turbulence .3 lambda 4 scale .1 poly_wave .5 colour_map { [.5 rgb <.05,.01,.0>][1 rgb x/2+y] } } } //a distant strip of mountains #declare oMountains = height_field { #declare f_pMount = function { pigment { wrinkles translate 0.5 scale <.2,.2,.15> } } function 1024, 512 { (.5+.5*cos(y*2*pi)) //ramp to flat at near and far edges * ( //pow( f_noise3d( x*8, y, 0 ), 1.5 ) f_pMount(x*2,0,y).red ) } translate -.5 scale <1024, 64, 512>/128 scale 3 translate <0,0,18> texture { pigment { gradient y turbulence-.2 translate -.5 scale 3/2 colour_map { [.6 rgb <.1,.08,.07>] [.7 rgb <1,1.1,1.2>] } } normal { pigment_pattern { wrinkles scale 100 } 1 scale 1/100 scale .1 } } //fog texture { pigment { rgbt <.0,.1,.4,.5> } finish { ambient 1 diffuse 0 } } } #if (gboGrass) //foreground grass on the hill #declare oGrass = mesh { #macro m_Place(vP) (trace( oHill, vP+y*1000, -y ) + vP.y*y) #end #macro m_Blade( vBase, vTop, fBaseWidth, fColourIdx ) //#declare vPerp = x*fBaseWidth; //total cheat, we know the camera position so make all blades face it! #declare vPerp = vnormalize(vnormalize(vcross(vTop-vBase,y))-z*.1)*fBaseWidth; //#declare vPerp = vrotate(x,rand(rs*180*y))*fBaseWidth; triangle { vBase, vTop, vBase-vPerp uv_vectors <0,fColourIdx>,<1,fColourIdx>,<1,fColourIdx> } triangle { vBase+vPerp, vTop, vBase uv_vectors <1,fColourIdx>,<1,fColourIdx>,<0,fColourIdx> } #end #declare fS = 1; //blade scale factor #declare rs = seed(121120); #declare nBlades = 100000; #declare nBlade = nBlades; #while ( nBlade > 0 ) #declare nGroup = max(nBlade-1000,0); #while ( nBlade > nGroup ) #declare vPos = ; #declare vPos = m_Place(vPos); #declare fHeight = 1+sin((vPos.z-vPos.x*.8)*40*pi*2)*.5; #declare vTop = vPos + ((vturbulence(2, .5, 6, vPos*20)*.0004 + (-.5)*.0004)*<1,.3,1> + y*fHeight*.0025)*fS; #declare vPos = vPos*2 - vTop;//push it underground a bit. m_Blade( vPos, vTop, .0002*fS, vturbulence(2, .5, 4, vPos*8).x*.5+.3 ) #declare nBlade = nBlade - 1; #end #debug concat( "blade ",str(nBlades-nBlade,1,0),"/",str(nBlades,1,0),"\n" ) #end uv_mapping hollow on double_illuminate pigment { #macro m_ColEntry( fVal, vCol ) //fade to transparent at the edges [fVal gradient x colour_map { [.5 rgb vCol][1 rgb vCol transmit 1] }] #end gradient y //colour axis pigment_map { m_ColEntry( -1, y ) m_ColEntry( 2, x+y ) } }//pigment } //same trick, different object #declare oFlowers = mesh { #macro m_Place(vP) (trace( oHill, vP+y*1000, -y ) + vP.y*y) #end #macro m_Flower( vPos, fRad ) triangle { vPos+fRad*<0,2>, vPos+fRad*<-sqrt(3),-1>, vPos+fRad* uv_vectors <0,2>,<-sqrt(3),-1>, } #end #declare fS = 1; //flower scale factor #declare rs = seed(12); #declare nFlowers = 1000; #declare nFlower = nFlowers; #while ( nFlower > 0 ) #declare vPos = ; #declare vPos = m_Place(vPos); #declare vPos = vPos + ((vturbulence(2, .5, 6, vPos*20)*.0004 + (-.5)*.0004)*<1,1,1> + y*.003)*fS; m_Flower( vPos, .0005*fS ) #declare nFlower = nFlower - 1; #end uv_mapping hollow on double_illuminate pigment { spherical colour_map { [0 rgb x+y transmit 1] [.6 rgb x+y] } }//pigment finish { diffuse 2 brilliance .5 } } #end //if gboGrass #declare oShadowCaster = disc { 0, y, 1 pigment { spherical scale <.5,1,1> rotate -y*50 scale 3 warp { turbulence -.5 octaves 3 } scale 1/3 colour_map { [.0 rgb 1 transmit .1] [.3 rgb 1 transmit .0] [.45 rgb 1 transmit .1] [.55 rgb 1 transmit .4] [.75 rgbt 1] } } } //draw it object { oMountains } union { object { oHill } #if (gboGrass) //create more grass #local fRad = .015*fS; #local nClone = 40; #while ( nClone > 0 ) object { oGrass translate (-.5)*<1,.1,1>*fRad } #local nClone = nClone - 1; #end object { oFlowers } #end translate <-.5,-.02,0> } //sun colour from Jaime Vives Piqueres' macros (available at http://www.ignorancia.org/) /* #include "macros/lightsys3/CIE.inc" #declare Kelvin_5000 = Kelvin(5000); #debug concat("5000 = <",str(Kelvin_5000.x,0,4),",",str(Kelvin_5000.y,0,4),",",str(Kelvin_5000.z,0,4),">\n") */ #declare Kelvin_5000 = <1.0000,0.7920,0.6275>; light_source { <-1,1,1>*100 rgb Kelvin_5000*.8 parallel point_at 0 } object { oShadowCaster //Reorient_Trans( y, <-1,1,0> ) translate <-.2,0,.5> //desired location of shadow translate <-1,1,1>*50 //move towards light } #if (!gboRad) light_source { <-2,1,-2>*100 rgb <.3,.5,1>*.07 //sky parallel point_at 0 shadowless } light_source { <2,1,-2>*100 rgb <.3,.5,1>*.04 //sky parallel point_at 0 shadowless } light_source { <-2,1,2>*100 rgb <.3,.5,1>*.04 //sky parallel point_at 0 shadowless } light_source { <2,1,2>*100 rgb <.3,.5,1>*.03 //sky parallel point_at 0 shadowless } #end sky_sphere { pigment { //sky gradient y poly_wave .2 colour_map { [0 rgb <.92,.97,1>] [.3 rgb <.92,.97,1>/2 + <0,.1,.8>/2 + y*.2] [.84 rgb <0,.1,.8>] //oversaturate the blue } } pigment { gradient y scale 2 translate -1 colour_map { [.5 rgb <.0,.1,.4>*.7 + <.1,.3,.0>*.3] //dark ground seen through fog [.5 rgbt 1] } } #declare f_Cloud = function { pigment { leopard scale .1*<1,.3,1> warp { turbulence .8*<1,0,1> lambda 3 omega .5 octaves 6 } } } //distant clouds pigment { function { min(1,max(0, f_Cloud(x,y,z).red*.3 + .7 - y*2 + x*.2 )) } pigment_map { #local e = 0.03; #local p = .5; [.3 function { .5 +.5*pow(f_Cloud(x+e,y-e,z-e).red,p) -.5*pow(f_Cloud(x-e,y+e,z+e).red,p) } colour_map { [.0 rgb <.1,.2,.6> transmit 1][1 rgb <1.2,1.3,1.6> transmit 1] } ] [.6 function { .5 +.5*pow(f_Cloud(x+e,y-e,z-e).red,p) -.5*pow(f_Cloud(x-e,y+e,z+e).red,p) } colour_map { [.0 rgb <.1,.2,.6>][1 rgb <1.2,1.3,1.6>] } ] } scale .3*<2,1,1> } //near clouds pigment { function { f_Cloud(x,y,z).red } pigment_map { #local e = 0.01; [.3 function { .5 +.5*f_Cloud(x+e,y-e,z-e).red -.5*f_Cloud(x-e,y+e,z+e).red } colour_map { [.0 rgb <.2,.2,.6> transmit 1][1 rgb 1.8 transmit 1] } ] [.6 function { .5 +.5*f_Cloud(x+e,y-e,z-e).red -.5*f_Cloud(x-e,y+e,z+e).red } colour_map { [.0 rgb <.2,.2,.6>][1 rgb 1.8] } ] } } } camera { right x*image_width/image_height direction z*1.0 rotate -x*7 }