/** * Idea to place waterdrops like on wet surfaces ... * by Jan Walzer (Jan.W@lzer.net) * needs megapov * blob version by Gilles Tran * **/ #include "colors.inc" #version unofficial Megapov 0.5; global_settings{ assumed_gamma 1 } camera{ location <0.0, 3, -2> look_at <0.0, 0, 1.25> angle 35 } light_source{<1,1.5,0.3>*1000 color rgb<1,0.9,0.8>} #declare pw=0.5; // very heavy and thick #declare pw=2; // thin drops #declare pw=1.5; // #declare MyPigment =pigment { bozo scale 1 poly_wave pw color_map{[0 Black][1 White]} scale 0.5 } plane {y,0 texture{pigment{rgb 1}finish{ambient 0 diffuse 0.8}}} #declare rd=seed(42); #declare rd2=seed(23); // Algorithm starts here... #declare sc=2; // drop size blob{ threshold 0.6 //union{ #declare Num=25000; #declare i=0; #while (Num>0) #declare Num=Num-1; #declare Pos=*5; #declare Var=rand(rd2); #declare colr=eval_pigment(MyPigment,Pos); #declare sze=sqr(colr.x)*2; #if ( sqr(sze) < Var * 2) #declare i=i+1; sphere{0,sc,1 scale sze*0.05+0.005 translate Pos } #end #end texture{ pigment{Red} finish{ambient 0 diffuse 0.50 specular 1 roughness 0.0001} } } #debug concat(str(i,0,0)+" drops placed\n")