//hdr test //using HDR maps from http://unparent.com/ #version unofficial megapov 1.21; #include "rad_def.inc" #include "transforms.inc" #declare rad=on; #declare lights=on; //better sampling of dome than radiosity will do, plus specular highlights work! #declare dome = pigment { image_map { //hdr "hdr/FINAL_outside.hdr" //hdr "hdr/probe_frontYard_FINAL.hdr" //hdr "hdr/probe_parkSun_FINAL.hdr" //hdr "hdr/beverlyHills_sun_probe_FINAL.hdr" //hdr "hdr/probe_beverlyHills_shade_FINAL.hdr" //hdr "hdr/probe_backporch_FINAL.hdr" //hdr "hdr/probe_frontRoom_FINAL.hdr" //hdr "hdr/probe_yard2_FINAL.hdr" hdr "hdr/PSneighbor_FINAL.hdr" //hdr "hdr/Japan_blossom_FINAL.hdr" map_type 7 interpolate 2 } } global_settings { //assumed_gamma .1 #if (rad) radiosity { Rad_Settings(Radiosity_Fast,on,on) } #end tone_mapping { #local expose = 1.3; //exposure control //function { min(x*expose,1) } //clamp colours, so AA works #local f = function(x) { #local curve=5; #local offst=-1; .5*(-sqrt(pow((x+offst)*curve,2)+1)+sqrt(pow((0+offst)*curve,2)+1))/curve +.5*x } //function { f(x*expose) } //function { pow(f(x*expose),1/2.2) } //this one //function { f(pow(x*expose,1/2.2)) } function { min(1,max(0,(pow(f(x*expose),(1/2.2)/.68)-.5)*128/(128-33) + .5)) } //tweaked in irfanview } } #default { pigment { rgb .9 } finish { diffuse 1 ambient 0 } } #declare signpow = function(x,p) { pow(abs(x),p-1)*x } #declare invpow = function(x,p) { select(x,-1+pow(1-abs(x),p),1-pow(1-abs(x),p)) } #macro do_lights() //takes a while so invoke at the end of the scene (so we get parse errors for other stuff first!) //make lights #if (lights) #local num_lights = 110; #local area_ang = 15; //degrees, set to 0 to use non-area lights, adjust according to numlights (30degrees good for 20 lights) #local blursamp = 20; //blur each light's source colour, so we don't sample just one pixel of the image. #local blurang = 15; //degrees #local f_samp = function { pigment { dome } }; #local rs = seed(14); #local rs2 = seed(32); #local i = 0; #while (i < num_lights) #local j=(i+.5)/num_lights; #local dir = vrotate(vrotate(z,),<0,0,0>); //#local dir = vrotate(z,); //average together several samples in the region #local col=<0,0,0>; #local s=0; #while ( s < blursamp ) #local dir2 = vrotate(z,); #local trans = transform { Reorient_Trans(z,dir) }; #local dir2 = vtransform(dir2, trans); #local samp = f_samp(dir2.x,dir2.y,dir2.z); #local s=s+1; #local col = col*(s-1)/s + samp/s; #end light_source { dir*1000, col*4/num_lights parallel point_at 0 #if (area_ang > 0) area_light x*1000*tan(radians(area_ang)),y*1000*tan(radians(area_ang)),4,4 adaptive 1 jitter circular orient #end } #local i=i+1; #end #end #end /* sky_sphere { pigment { dome } } */ sphere { //so I can do no_radiosity 0, 1 pigment { dome } finish { ambient 1 diffuse 0 } scale 2000 inverse no_shadow #if (lights) //lighting from dome is being faked by lights no_radiosity #end } camera { right x up y*image_height/image_width // direction z*.9 location <-4,1,-1>*1.5 look_at -y/2 // direction z*.7 location <-2,-.5,-3> look_at 0*y direction z*.9 location <4,0,-1>*1.2 look_at -y/4 } /* sphere { 0, 1 texture { pigment { rgb <0,.2,.03> } finish { brilliance 4 } } texture { pigment { rgb <0,.2,.03> transmit 1 } normal { facets coords 1 scale .05 } //finish { phong 2 phong_size 20 } //blurrier finish { reflection { .3 metallic 1 } } //cleaner } texture { pigment { rgbt 1 } finish { reflection { 0, 1 fresnel } conserve_energy } } interior { ior 1.3 } //finish { brilliance 100 diffuse 20 } //debug light placement } cylinder { -y, -y*5, 2 pigment { rgb <.3,.18,.1> } normal { granite -.1 scale .2 } } */ union { box { -1, 1 scale <1.6,.1,1.6> translate -y } #local a=0; #while ( a < 360 ) cylinder { z-y,z+y,.1 rotate y*a } #local a = a + 360/9; #end cylinder { y*.9,y*1.1,1.2 } cylinder { -y*.7,-y*.9,.7 } cylinder { y*1.1,y*1.3,.7 } normal { granite .1 scale .1 } } sphere { <-1.5,-.7,1>, .2 pigment { rgb .9 } finish { diffuse 0 reflection { 1 metallic 1 } } } sphere { <.5,-.7,-1.3>, .2 } sphere { <1,-.7,1.0>, .2 //show off radiosity pigment { rgb <.6,1,.8> } finish { diffuse 1 ambient .8 } } cylinder { -y,-y*1.11,3.01 pigment { rgb 0 transmit .95 } finish { reflection { 0, 1 fresnel } conserve_energy } normal { granite -.1 scale .5 } interior { ior 1.33 fade_colour rgb <0,.04,.02> fade_distance .01 fade_power 1 } } difference { cylinder { -y*.9,-y*1.2,3.2 } cylinder { 0,-y*1.1,3 } normal { granite .1 scale .1 } } //do this last, so we get any parse errors sooner. do_lights()