//Dispersion spectrum macro written by Nathan Kopp #macro create_spectrum(nelems,bright) #local elem=1; color_map{ #while(elem<=nelems) /* h goes from 0 at red end to 1.0 at blue end */ #local h = (elem-1)/(nelems-1); /* co-h goes from 1.0 at red end to 0.0 at blue end */ #local coh = 1.0 - h; #local Huered = 0.9 - (h/0.5); #local Hueblue = 1.0 - (coh/0.6); #if (Huered < 0.0) #local Huered = 0.0; #end #if (Hueblue < 0.0) #local Hueblue = 0.0; #end #local Huered=1.0 - (1.0-Huered)*(1.0-Huered); #local Hueblue=1.0 - (1.0-Hueblue)*(1.0-Hueblue); #local Huegreen = 1.0 - Huered - Hueblue; #if (h>0.85) #local Huered = 4*(h-0.85); // was 4 - changed to 8 #end #local ybulge = -4.0*(h-0.1)*(h-0.6); #if (ybulge<0) #local ybulge=0; #end #local Huered = Huered+ybulge;// * 0.5; // added * 0.5 #local Huegreen = Huegreen+ybulge; [bright, color rgb] //#debug concat("<",str(Huered,0,3),",",str(Huegreen,0,3),",",str(Hueblue,0,3),">\n") #local elem=elem+1; #end // while } #end // macro #include "colors.inc" camera{location <3,4,5> look_at 0} light_source{<10,7,5> 1 create_spectrum(64,1/64)} #declare phd = 1; //Set to true for the first rendering and whenever the "phd" or "separation" settings are changed // or when changing a light source. //Set to false for all other renderings #declare First_Render = true; global_settings{ max_trace_level 20 photons{ gather 20, 100 radius 0.1*phd, 3, 0.1*phd autostop 0 jitter .4 expand_thresholds 0.2, 40 #if(First_Render) save_file "pdata.ph" #else load_file "pdata.ph" #end } } #declare Water1 = material{ texture { pigment{rgbft <0.9,0.9,1.0,.9,2.5>} finish{ diffuse .6 reflection 0.4 refraction 1.0 phong 1.5 phong_size 250 } scale <0.5,0.5,0.5> } interior{ ior 1.33 dispersion 1.2 disp_nelems 0 } } #declare Water2 = material{ texture{ pigment{ rgbf <0.9,0.9,1.0,.99>} finish{ diffuse .05 reflection 0.4 refraction 1.0 phong 1.5 phong_size 250 } scale <0.5,0.5,0.5> } interior{ ior 1.33 dispersion 1.2 disp_nelems 0 } } //The water drop quartic{ < 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, -1, 2, 0, -2, 1> rotate x*-90 inverse #if(First_Render) material{Water1} #else material{Water2} #end photons{ refraction on ignore_photons separation 0.003*phd } bounded_by{box{<-.8,-1.5,-.8>,<.8,1,.8>}} scale y*1.2 translate y*3 } plane{y, -2 pigment{checker color rgb 1 color rgb .9} finish{diffuse .9}}