// Persistence of Vision Ray Tracer Scene Description File // File: FireWrks.inc // Vers: 3.1 // Desc: A fireworks macro include-file // Date: 1999-01-31 // Auth: Spider (spider@bahnhof.se) #version 3.1; /* macros included are SingleRay <-- Make a single, coiling trail towards a point DoubleRay <-- Make a double, coiling trail towards a point Boom <-- make an explosion at a point */ /* ************************************************ ***IMPORTANT************************************ ************************************************ Here are some Value specifications that may be useful! SingleRay/DoubleRay V_High Anywhere, pretty high up, 100*y - 300*y (vector) Radii depends on distance, good are 0.3 - 1 Steps Take rather high for a smoother trace, 500-1000 RotationFactor Keep medium high, 75-200 should be ok, test. EndColour Try using a FULL colour value( <1,1,0>, <1,0.5,0> or so) (Should be used as : colour rgb <1,1,0> ) EndAmbient try using a full colour value here to. (A vector, <1,1,0> ) Boom VCenter A place pretty high up, 150-300, vector BaseRadius A value for the INNER radius, try 15-50, depending on height/distance StepRadius how much to increase the raius each step, try 5-30, or a negative (Shrinks the radius.) Layers This defines how many globes in each firework, try 3-6 BaseNumber This is a squareRoot of the actual amount of dots, marks the tightness of each layer. StepNumber How much to change the tightness in each step, try a negative for a thinner outer sphere. RandFactor How many units each dot of the explosion can move, try 2-15 RandSeed A seed(pi) or something Colour The Colour of the explosion, use a bright colour for good effect, This is only seen in the outermost globe. Also the colour of the light_source. FadeMul A multiplier for light-fading of the explosion. Note, if you are using a negative StepNumber, make sure taht Layers*StepNumber < (BaseNumber+2), or there will be an error A good way to calculate BaseNumber is : abs(StepNumber*Layers)+5 */ /* Settings explination for the Ray macros V_High // End point for explosion, will go from <0,0,0> to this Radii // How big radius the trail shall coil around Steps // The amount of dots in a SINGLE trail, this doubles in double ray RotationFactor // How many times shall it rotate around the center ? EndColour // The colour to fade TO EndAmbient // The ambient to fade TO */ /* Settings explination for Boom Boom(VCenter,BaseRadius, StepRadius, Layers, BaseNumber, StepNumber, RandFactor, RandSeed, Colour) VCenter = <0,150,0>; //The center of the explosion BaseRadius = 15; //The inner radius of the explosion StepRadius = 5; //How much it should grow each step Layers = 3; //How many steps out BaseNumber = 10; //How many circles/sphere and dots/circle StepNumber = 3; //How manyt more each step RandFactor = 10; //How much to move each dot. randomized, -RandFactor to RandFactor RandSeed = seed(1234321); //This is fairly obvious.. Can YOU guess ??? *lol* Colour = colour rgb <1,1,0>; //The MAXIMUM colour value. Shaded from black to this. FadeMul 1.8 //A multiplier for light-fading. try between 0.5 and 3 . */ /* Here, I'll count some on the number of objects, and the amount of memory that follows.. Starting form theese settings : Layers : 4 BaseNumber : 9 StepNumber : 3 A Circle contains BaseNumber of dots. A sphere of cricles contains BaseNumber^2 of dots Thereafter you get (BaseNumber+1*StepNumber)^2+ (BaseNumber+2*StepNumber)^2+ (BaseNumber+3*StepNumber)^2+ (BaseNumber+4*StepNumber)^2 of dots. This ends in this case with : (9+1*3)^2+(9+2*3)^2+(9+3*3)^2+(9+3*3)^2=693 3 sum (9+(k*3))^2 k=1 */ #macro SingleRay(V_High, Radii, Steps,RotationFactor, EndColour, EndAmbient) union { #local iSteps = 1/Steps; #local N = 0; #local Rot = RotationFactor*360*iSteps; #while(N, 0.09 rotate <0,N*Rot,0> translate NiSteps*V_High texture { pigment { colour NiSteps*EndColour } finish{ ambient NiSteps*EndAmbient } } } #local N=N+1; #end } #end #macro DoubleRay(V_High, Radii, Steps,RotationFactor, EndColour, EndAmbient) union { #local iSteps = 1/Steps; #local N = 0; #local Rot = RotationFactor*360*iSteps; #while(N, 0.09 rotate <0,0,0> } sphere { , 0.09 rotate <0,180,0> } rotate <0,N*Rot,0> translate NiSteps*V_High texture { pigment { colour NiSteps*EndColour } finish{ ambient NiSteps*EndAmbient } } } #local N=N+1; #end } #end #macro Rnd(Seed,Fact) (((Fact*2)*rand(Seed))-Fact) #end //Rotation is a rotate thing applied to all objects. Reason ? Breaking the unions apart, //Thus saving MEMORY by applying the texture a step further out. //Now, did it work ??? //Yes, same fireworks, before and after, only diff. is : //from 34Mb of memory req. to 9Mb. I call that an optimization. Don't you ? #macro MakeCircle(Radius, Number, RandFact, RandSeed,Rotation) #local N = Number; #local iN360 = (1/N)*360; #while(N>0) #local Trans = transform { translate <0,0,Radius> rotate <0,iN360*N,0> translate rotate Rotation } sphere { <0,0,0>,0.2 transform Trans no_shadow} #local N=N-1; #end #end #macro MakeGlobe(Radii, Number, RandFact, RandSeed, Colour) #local N = Number; #local iN360 = (1/N)*360; union { #while(N>0) MakeCircle(Radii, Number, RandFact, RandSeed, <0,0,iN360*N>) #local N=N-1; #end texture { pigment { Colour } } } #end #macro Boom(VCenter,BaseRadius, StepRadius, Layers, BaseNumber, StepNumber, RandFactor, RandSeed, Colour, FadeMul) #local N = Layers; light_source{ <0,0,0> colour Colour looks_like { union { #while(N>1)//Didn't use 0 here, used 1 to not have some black spheres #local Cl = colour (Colour/Layers)*N; object { MakeGlobe(BaseRadius+N*StepRadius, BaseNumber+N*StepNumber, RandFactor, RandSeed, Cl) } #local N = N-1; #end } } translate VCenter fade_distance (BaseRadius+(Layers*StepRadius))*FadeMul fade_power 3 media_attenuation on //I've found that theese settings work rather well. Change if you want. } #end