// Persistence of Vision Ray Tracer Scene Description File // File: megapov template // Author: #version unofficial megapov 1.0; global_settings { assumed_gamma 2.0 ambient_light .7 } background {color rgb < 1, 1, 1>*.0} // perspective (default) camera camera { // location <-5, 5, -25.0> location 2*<-0, 5, -25.0> look_at <0.0, 0.0, 0.0> right x*image_width/image_height angle 20 } #macro SRand(RS) (rand(RS)*2 - 1) #end #macro RRand(RS, Min, Max) (rand(RS)*(Max-Min) + Min) #end #macro Clamp(V, Min, Max) (min(Max, max(Min, V))) #end #macro Range(V, Rmn, Rmx) (V*(Rmx-Rmn) + Rmn) #end #macro RClamp(V, Rmn, Rmx, Min, Max) (Clamp(Range(V, Rmn, Rmx), Min, Max)) #end #local RsA = seed(574643); //a smooth transition function #declare trans = function(s,L) {(1+sin(pi*min(max(-.5,s/L),.5)))*.5 } #local tube_radius = 1.8; #local tube_halflength = 10; #local spot_spacing=1; #local v_0 = tube_halflength; //(initial) speed of particles #declare r_function = function(s) { tube_radius*(1-.5*trans(s-.5,4)) } #declare v_function = function(s) {v_0*tube_radius*tube_radius/(r_function(s)*r_function(s))} #local lclock=clock+.0; #local tstart = -1*tube_halflength/v_0; //initialize the "head start" of each successive wave #local dtstart=spot_spacing/v_0; //wave interval spacing #local dtt=dtstart/10; //integration interval #while(tstart<=2*tube_halflength/v_0) #local yr = -tube_radius; #while(yr<=tube_radius) #local zr = -tube_radius; #while(zr<=tube_radius) #local ynow=yr+SRand(RsA)*.25*spot_spacing; #local znow=zr+SRand(RsA)*.25*spot_spacing; #if(ynow*ynow+znow*znow< tube_radius*tube_radius) //gotta be inside #local t_this_head_start=tstart+SRand(RsA)*.25*spot_spacing; //start em at the left end #local t_int = 0; #local xnow=-tube_halflength; #while(t_int-tube_halflength+spot_spacing) /* sphere{ , .1 texture{pigment { color rgbt <.1,.1,.9,.0> } finish{ambient .9 diffuse .9}} no_shadow } */ light_source { < xnow, ynow, znow> color rgb .4*< .1, .1, 1> glow { size .1 type 2} fade_distance .4 fade_power 4 } /* */ #end #end #end #declare zr=zr+ spot_spacing; #end #declare yr=yr+ spot_spacing; #end #declare tstart=tstart+ dtstart; #end #local section_width=tube_halflength/40; #local pxnow = -tube_halflength; merge{ #while(pxnow } finish{ambient .3 diffuse .6}} no_shadow } /* difference{ cylinder { <-1*tube_halflength, 0, -0>, <1*tube_halflength, 0, 0>, tube_radius+.25} cylinder { <-1*tube_halflength, 0, -0>, <1*tube_halflength, 0, 0>, tube_radius} texture{pigment { color rgbt <.2,.2,.2,.7> } finish{ambient .3 diffuse .6}} no_shadow translate -0*y } */ // create a regular point light source light_source { 0*x // light's position (translated below) color rgb <1,1,1> // light's color translate <0, 10, -30> }