///////////////////////////////////////// // // // Luminous Bloom version 6 // // now supporting // // High Dynamic Range Images // // 2009 Samuel T. Benge // // distribute freely // // // ///////////////////////////////////////// // remember to keep the output image size the same as the input image siz e // render without aa for speed // beware of using png files which may have their own gamma values // refer to image_pw for important information about HDR images // you can change the gamma, if needed //global_settings{assumed_gamma 2.2} // global ambient value - do not change #default{finish{ambient 1}} // don't change the camera :) camera{ orthographic right x*2 up y*2 location z*-1 look_at 0 } // "pts_circle" provides the points to be used for the bloom effect #declare pts_circle=array[227]{<0,0.1,0>,<0.0951057,0.0309017,0>,<0.058 7785,-0.0809017,0>,<-0.0587785,-0.0809017,0>,<-0.0951057,0.0309017,0>,<0, 0.2,0>,<0.117557,0.161803,0>,<0.190211,0.0618034,0>,<0.190211,-0.0618034, 0>,<0.117557,-0.161803,0>,<2.44929e-017,-0.2,0>,<-0.117557,-0.161803,0>,< -0.190211,-0.0618034,0>,<-0.190211,0.0618034,0>,<-0.117557,0.161803,0>,<0 ,0.3,0>,<0.122021,0.274064,0>,<0.222943,0.200739,0>,<0.285317,0.0927051,0 >,<0.298357,-0.0313585,0>,<0.259808,-0.15,0>,<0.176336,-0.242705,0>,<0.06 23735,-0.293444,0>,<-0.0623735,-0.293444,0>,<-0.176336,-0.242705,0>,<-0.2 59808,-0.15,0>,<-0.298357,-0.0313585,0>,<-0.285317,0.0927051,0>,<-0.22294 3,0.200739,0>,<-0.122021,0.274064,0>,<0,0.4,0>,<0.123607,0.380423,0>,<0.2 35114,0.323607,0>,<0.323607,0.235114,0>,<0.380423,0.123607,0>,<0.4,2.4492 9e-017,0>,<0.380423,-0.123607,0>,<0.323607,-0.235114,0>,<0.235114,-0.3236 07,0>,<0.123607,-0.380423,0>,<4.89859e-017,-0.4,0>,<-0.123607,-0.380423,0 >,<-0.235114,-0.323607,0>,<-0.323607,-0.235114,0>,<-0.380423,-0.123607,0> ,<-0.4,-7.34788e-017,0>,<-0.380423,0.123607,0>,<-0.323607,0.235114,0>,<-0 .235114,0.323607,0>,<-0.123607,0.380423,0>,<0,0.5,0>,<0.124345,0.484292 ,0>,<0.240877,0.438153,0>,<0.342274,0.364484,0>,<0.422164,0.267913,0>,<0. 475528,0.154508,0>,<0.499013,0.0313953,0>,<0.491144,-0.0936907,0>,<0.4524 14,-0.21289,0>,<0.385257,-0.318712,0>,<0.293893,-0.404508,0>,<0.184062,-0 .464888,0>,<0.0626666,-0.496057,0>,<-0.0626666,-0.496057,0>,<-0.184062, -0.464888,0>,<-0.293893,-0.404508,0>,<-0.385257,-0.318712,0>,<-0.452414,- 0.21289,0>,<-0.491144,-0.0936907,0>,<-0.499013,0.0313953,0>,<-0.475528,0. 154508,0>,<-0.422164,0.267913,0>,<-0.342274,0.364484,0>,<-0.240877,0.4381 53,0>,<-0.124345,0.484292,0>,<-1.01064e-015,0.5,0>,<0,0.6,0>,<0.124747,0. 586889,0>,<0.244042,0.548127,0>,<0.352671,0.48541,0>,<0.445887,0.401478,0 >,<0.519615,0.3,0>,<0.570634,0.18541,0>,<0.596713,0.0627171,0>,<0.596713, -0.0627171,0>,<0.570634,-0.18541,0>,<0.519615,-0.3,0>,<0.445887,-0.401478 ,0>,<0.352671,-0.48541,0>,<0.244042,-0.548127,0>,<0.124747,-0.586889,0>,< 7.34788e-017,-0.6,0>,<-0.124747,-0.586889,0>,<-0.244042,-0.548127,0>,<-0. 352671,-0.48541,0>,<-0.445887,-0.401478,0>,<-0.519615,-0.3,0>,<-0.570634, -0.18541,0>,<-0.596713,-0.0627171,0>,<-0.596713,0.0627171,0>,<-0.570634,0 .18541,0>,<-0.519615,0.3,0>,<-0.445887,0.401478,0>,<-0.352671,0.48541,0 >,<-0.244042,0.548127,0>,<-0.124747,0.586889,0>,<0,0.7,0>,<0.12499,0.6887 51,0>,<0.245962,0.655364,0>,<0.359029,0.600914,0>,<0.460557,0.52715,0>,<0 .547282,0.436443,0>,<0.616417,0.331708,0>,<0.66574,0.216312,0>,<0.69366 5,0.0939633,0>,<0.699295,-0.0314054,0>,<0.68245,-0.155765,0>,<0.643669,-0 .275118,0>,<0.584201,-0.385628,0>,<0.505956,-0.483744,0>,<0.41145,-0.56 6312,0>,<0.303719,-0.630678,0>,<0.186226,-0.674774,0>,<0.0627475,-0.69718 2,0>,<-0.0627475,-0.697182,0>,<-0.186226,-0.674774,0>,<-0.303719,-0.63067 8,0>,<-0.41145,-0.566312,0>,<-0.505956,-0.483744,0>,<-0.584201,-0.385628, 0>,<-0.643669,-0.275118,0>,<-0.68245,-0.155765,0>,<-0.699295,-0.0314054,0 >,<-0.693665,0.0939633,0>,<-0.66574,0.216312,0>,<-0.616417,0.331708,0>,<- 0.547282,0.436443,0>,<-0.460557,0.52715,0>,<-0.359029,0.600914,0>,<-0.245 962,0.655364,0>,<-0.12499,0.688751,0>,<-1.4149e-015,0.7,0>,<0,0.8,0>,<0.1 25148,0.790151,0>,<0.247214,0.760845,0>,<0.363192,0.712805,0>,<0.470228,0 .647214,0>,<0.565685,0.565685,0>,<0.647214,0.470228,0>,<0.712805,0.3631 92,0>,<0.760845,0.247214,0>,<0.790151,0.125148,0>,<0.8,4.89859e-017,0>,<0 .790151,-0.125148,0>,<0.760845,-0.247214,0>,<0.712805,-0.363192,0>,<0.6 47214,-0.470228,0>,<0.565685,-0.565685,0>,<0.470228,-0.647214,0>,<0.36319 2,-0.712805,0>,<0.247214,-0.760845,0>,<0.125148,-0.790151,0>,<9.79717e-01 7,-0.8,0>,<-0.125148,-0.790151,0>,<-0.247214,-0.760845,0>,<-0.363192,-0.7 12805,0>,<-0.470228,-0.647214,0>,<-0.565685,-0.565685,0>,<-0.647214,-0.47 0228,0>,<-0.712805,-0.363192,0>,<-0.760845,-0.247214,0>,<-0.790151,-0.125 148,0>,<-0.8,-1.46958e-016,0>,<-0.790151,0.125148,0>,<-0.760845,0.247214, 0>,<-0.712805,0.363192,0>,<-0.647214,0.470228,0>,<-0.565685,0.565685,0>,< -0.470228,0.647214,0>,<-0.363192,0.712805,0>,<-0.247214,0.760845,0>,<-0.1 25148,0.790151,0>,<0,0.9,0>,<0.125256,0.891241,0>,<0.248074,0.865136,0>,< 0.366063,0.822191,0>,<0.476927,0.763243,0>,<0.578509,0.68944,0>,<0.66883, 0.602218,0>,<0.746134,0.503274,0>,<0.808915,0.394534,0>,<0.855951,0.27811 5,0>,<0.886327,0.156283,0>,<0.899452,0.0314095,0>,<0.89507,-0.0940756,0>, <0.873266,-0.21773,0>,<0.834465,-0.337146,0>,<0.779423,-0.45,0>,<0.70921, -0.554095,0>,<0.625193,-0.647406,0>,<0.529007,-0.728115,0>,<0.422524,-0.7 94653,0>,<0.307818,-0.845723,0>,<0.187121,-0.880333,0>,<0.0627808,-0.8978 08,0>,<-0.0627808,-0.897808,0>,<-0.187121,-0.880333,0>,<-0.307818,-0.8457 23,0>,<-0.422524,-0.794653,0>,<-0.529007,-0.728115,0>,<-0.625193,-0.64740 6,0>,<-0.70921,-0.554095,0>,<-0.779423,-0.45,0>,<-0.834465,-0.337146,0>,< -0.873266,-0.21773,0>,<-0.89507,-0.0940756,0>,<-0.899452,0.0314095,0>,<-0 .886327,0.156283,0>,<-0.855951,0.278115,0>,<-0.808915,0.394534,0>,<-0.7 46134,0.503274,0>,<-0.66883,0.602218,0>,<-0.578509,0.68944,0>,<-0.476927, 0.763243,0>,<-0.366063,0.822191,0>,<-0.248074,0.865136,0>,<-0.125256,0.89 1241,0>,} // ********************************************************************** // begin user settings // ********************************************************************** // it all starts here #declare image_pigment= pigment{ image_map{ // your image file here tga"file_name.tga" once // Interpolation helps to enhance the antialiasing of the original imag e. //interpolate 2 } // these warp statements reduce unwanted image border artifacts warp{repeat x flip x} warp{repeat y flip y} // image orientation - do not change #declare image_scale = 2; scale image_scale translate (image_scale/2)*<-1,-1,0> } // intensity of glare effect #declare intensity = 1; // quality of the effect // use values between 0 and 1 (with 1 being best [and slowest]) #declare quality = 1; // intensity falloff method // 0 = constant falloff // 1 = intensity divided by distance - default // 2 = inverse square of distance #declare falloff_method = 2; // radius of effect // change independent values for width/height // eg. for 320x240 use <1,1.33>*.1 #declare rad = <1,1.33>*.2; // rotate the effect // useful when using disproportionate radii #declare rotation = 1; // change the intensity of the whole image #declare overall_intensity = 3; // default 3 // the the darkness of dark areas, useful for contrast adjustment #declare overall_darkness = 0; // default 0 // poly_wave value for glare effect only // Lower values will make more of the image produce glare, higher values // will cause only the brighter spots to cast a glare. #declare pw = 3; // poly_wave value for original image // useful for adjusting to different gammas #declare image_pw = 2.0; // 1.0 for HDR images, 2.0 for everything else // intensity of original colors, increase to saturate (and brighten) imag e #declare image_intensity = 1.0; // default 1.0 // ********************************************************************** // end user settings // ********************************************************************** // ********************************************************************** // no need to change below code // image as a function #declare figm= function{ pigment{ average pigment_map{ #declare V=0; #while(V rotate -z*rotation ] #declare V=V+1/quality; #end } } } #declare figm2= function{pigment{image_pigment}} #declare figmra= function{ figm2(x,y,z).red } #declare figmga= function{ figm2(x,y,z).green } #declare figmba= function{ figm2(x,y,z).blue } #declare figmx= function{select(figmra(x,y,z)-1,figmra(x,y,z),1)} #declare figmy= function{select(figmga(x,y,z)-1,figmga(x,y,z),1)} #declare figmz= function{select(figmba(x,y,z)-1,figmba(x,y,z),1)} //************** #declare figm1ra= function{ figm(x,y,z).red } #declare figm1ga= function{ figm(x,y,z).green } #declare figm1ba= function{ figm(x,y,z).blue } #declare figm1x= function{select(figm1ra(x,y,z)-1,figm1ra(x,y,z),1)} #declare figm1y= function{select(figm1ga(x,y,z)-1,figm1ga(x,y,z),1)} #declare figm1z= function{select(figm1ba(x,y,z)-1,figm1ba(x,y,z),1)} #declare image_pigment2= pigment{ average pigment_map{ //[.1 bumps scale .004] [1 #declare f1=function{pigment{function{figmx(x,y,z)}poly_wave image_p w color_map{[0 rgb 0][1 rgb image_intensity]}}} #declare f2=function{pigment{function{figm1x(x,y,z)}poly_wave pw col or_map{[0 rgb 0][1 rgb intensity]}}} #declare f= function{ #if(intensity>0) (f1(x,y,z).x+f2(x,y,z).x) #else f1(x,y,z).x #end } function{select(f(x,y,z)-1,f(x,y,z),1)} color_map{[0 rgb -overall_darkness][1 rgb x*overall_intensity ]} #undef f1 #undef f2 #undef f ] [1 #declare f1=function{pigment{function{figmy(x,y,z)}poly_wave image_p w color_map{[0 rgb 0][1 rgb image_intensity]}}} #declare f2=function{pigment{function{figm1y(x,y,z)}poly_wave pw col or_map{[0 rgb 0][1 rgb intensity]}}} #declare f= function{ #if(intensity>0) (f1(x,y,z).y+f2(x,y,z).y) #else f1(x,y,z).y #end } function{select(f(x,y,z)-1,f(x,y,z),1)} color_map{[0 rgb -overall_darkness][1 rgb y*overall_intensity ]} #undef f1 #undef f2 #undef f ] [1 #declare f1=function{pigment{function{figmz(x,y,z)}poly_wave image_p w color_map{[0 rgb 0][1 rgb image_intensity]}}} #declare f2=function{pigment{function{figm1z(x,y,z)}poly_wave pw col or_map{[0 rgb 0][1 rgb intensity]}}} #declare f= function{ #if(intensity>0) (f1(x,y,z).z+f2(x,y,z).z) #else f1(x,y,z).z #end } function{select(f(x,y,z)-1,f(x,y,z),1)} color_map{[0 rgb -overall_darkness][1 rgb z*overall_intensity ]} ] } } // underlying, unaffected image #declare image= plane{z,0 pigment{ image_pigment2 } } object{image translate z*.001}