When looking for creating an electric arc in POVRAY, I stumbled upon Rune's Electricity Include File. However, it used elements found only in MegaPov. This is my adaptation for use in regular old POVray.
#macro ElectricPath(V) LinearPath( <1,0,0>, <-1,0,0>, V ) #end #macro ElectricColor(V) <0.4,0.7,1> #end // The output is a point that moves from PointA to PointB // as Value goes from 0.0 to 1.0 #macro LinearPath (PointA,PointB,Value) (PointA*(1-Value)+PointB*Value) #end // The output is a color vector that changes from ColorA to Color B // as Value goes from 0.0 to 1.0 #macro LinearColor (ColorA,ColorB,Value) ( vnormalize( ColorA*(1-Value) + ColorB*Value ) *( vlength(ColorA)*(1-Value) + vlength(ColorB)*Value ) ) #end // This is the Electric macro. It calls the internal _Electric macro // specified further down. #macro Electric(Brightness,Thickness,Fuzzyness,RollSpeed,FlickerSpeed,MinDist) union{ _Electric(0,1,ElectricPath(0),ElectricPath(1),1,-((ElectricPath(0))+(ElectricPath(1)))*100) } #end // This macro is used internally only. // The user do not need to call this macro. #macro _Electric(ValueA,ValueB,PointA,PointB,Level,Offset) #local ValueM = (ValueA+ValueB)/2; #local FlickerClock = int((clock*FlickerSpeed+vturbulence(0,0,0,Offset+FlickerSpeed*z*clock).y)); #local Turbulence = vturbulence(0,0,0,Offset-<100*FlickerClock,RollSpeed*clock,0>); #local PointM = ( (PointA+PointB)/2 +(ElectricPath(ValueM))-((ElectricPath(ValueA))+(ElectricPath(ValueB)))/2 +Turbulence*vlength(PointA-PointB)*Fuzzyness ); #local TempColor = (ElectricColor(ValueM)*Brightness); light_source { PointM, rgb TempColor*(Thickness/10) } sphere{ PointM, Thickness/2 no_shadow pigment{ rgb TempColor*5 } } #if (vlength(PointA-PointM)>MinDist) _Electric(ValueA,ValueM,PointA,PointM,Level+1,Offset+pow(3,Level)*x) #end #if (vlength(PointB-PointM)>MinDist) _Electric(ValueB,ValueM,PointB,PointM,Level+1,Offset+pow(3,Level)*y) #end #end
camera { location -50*z look_at 0 } light_source { <1,3,-2>*1000, rgb 1} union { sphere {<20,12,0>, 2} cylinder {<20,-100,0>, <20,12,0>, 1} pigment {color rgb 0.8} finish {brilliance 2 reflection 0.5} } union { sphere {<-20,12,0>, 2} cylinder {<-20,-100,0>, <-20,12,0>, 1} pigment {color rgb 0.8} finish {brilliance 2 reflection 0.5} } #include "electric.inc" #macro ElectricPath(V) LinearPath( <-18,12,0>, <18,12,0>, V ) #end #macro ElectricColor(V) <0.4,0.7,1.0> #end // This is optional: it's default // Brightness,Thickness,Fuzzyness,RollSpeed,FlickerSpeed,MinDist Electric( 0.3 , 0.2 , 0.5 , 0 , 0 , 0.1 )