// Persistence of Vision Ray Tracer Scene Description File // File: fadetext.pov // Vers: 3.6.1 // Desc: Test for texture-effect // Date: 11.01.05 (dd.mm.yy) // Auth: Tim Nikias Wenclawiak // Last Update: 21.01.05 (dd.mm.yy) //Description // Fades some text with particles. Requires Parsys, my I/O-based particle system. // Refer to the particle system's help for further details on the particle system. // Note that the text is actually just a pattern mapped onto a box, and I'm using // an orthographic camera to get rid of the coincident-surface problem with a trick. // Why? The particles are just plain discs with a surface-normal equal to the // viewing direction of the camera. If I'd place them all on a single plane, their // surfaces would overlap. Displacing the particles on the z-axis by a random // amount gets rid of coincident-surface (as they are now layered behind each // other) and since the camera is orthographic, closer particles aren't rendered // larger than particles that are further away. A quick hack for testing purposes // only, I dropped this attempt as soon as I realized the slow-rendering times. /*Commandline for 4 seconds at 25fps +kfi1 +kff100 */ //Homepage: // www.nolights.de //Email: // LOWERCASEONLYtimISNTnikias[AT]gmx.netWARE #include "parsys.inc" #declare Animation_Time = 4; //Time of Animation in Seconds global_settings{ assumed_gamma 1 max_trace_level 256 } camera{ orthographic location <0,0,-6> look_at <0,0,0> } //Macro to generate Function/pattern #macro Blowtext_Function(_Text,_Clock) #local The_Text=text {ttf "arial.ttf" _Text .5, <0,0,0>} #declare BlowText_Min = min_extent(The_Text); #declare BlowText_Max = max_extent(The_Text); #local The_Text = object{The_Text translate -(BlowText_Max-BlowText_Min)/2} #local Text_Fnct = function{pigment{object{The_Text color rgb 0 color rgb 1}}} #local _Mod = _Clock; #local Wind_1 = pigment{bozo poly_wave 2 color_map{[0 rgb 1-_Mod][1 rgb 1-pow(_Mod,3)]} scale <3,1,1> scale .1} #local Wind_2 = pigment{bozo poly_wave 2 color_map{[0 rgb max(1-_Mod*2,0)][1 rgb max(min(1.3-_Mod*2,1),0)]} scale <3.5,1,1> translate <23,52,12> scale .1} #local Blow1_Fnct = function{pigment{bozo color_map{[0 rgb 1][1 rgb #if (_Mod>.5) 1-(_Mod-.5)*2 #else 1 #end]} scale .21}} #local Blow2_Fnct = function{ pigment{ gradient x poly_wave 2 pigment_map{[0 Wind_1][1 Wind_2]} scale (BlowText_Max-BlowText_Min)*<1,0,0>+<0,1,1> translate -x*(BlowText_Max-BlowText_Min)/2 } } #local Final_Fnct = function{Text_Fnct(x,y,z).x*Blow1_Fnct(x,y,z).x*Blow2_Fnct(x,y,z).x} //Return pigment function{Final_Fnct(x,y,z)} #end //Gather functions for current pattern and former pattern #declare Wind_Blown_Now = min(clock*2,1); #declare Wind_Blown_Then = min((clock-clock_delta)*2,1); #declare BT_1 = Blowtext_Function("Blow Me Away",Wind_Blown_Now); #declare BT_2 = Blowtext_Function("Blow Me Away",Wind_Blown_Then); //Place pattern on box to see box{BlowText_Min,BlowText_Max translate -(BlowText_Max-BlowText_Min)/2*<1,1,0> pigment{function{BT_1(x,y,z)}} finish{ambient 1 diffuse 0} } //Particle-Macro, refer to Help of Particle System #macro Dust_Particle(Data) #local R=seed(Data[4].x*1000); disc{0,-z+*.02,1 hollow pigment{ spherical color_map{ [0 rgb Data[4] transmit 1] [1 rgb Data[4] transmit .6+.4*Data[0].x/Data[0].y] } } finish{ambient 1} scale .02+.25*pow(min(Data[0].x,1),2) translate Data[2] } #end //Begins Group ParticleGroup_Begin("dust",<1,1,10>) ParticleGroup_LinearWind(-x-z*.2,7,.05) ParticleGroup_TurbWind( 2.5,.55,12,.01, //Turbulence Settings <0,0,0>+z*10*clock, //Modifies position of field 3, //Multiplier for the speeds generated by turbulence .01) ParticleGroup_End() #declare SceneRand = seed(clock*20000); //Samples per frame to check (note that only those samples actually touching the // "white" of the pattern will be used #declare Dust_Samples = 2000; #declare Max_Dust = 1; //Sampling the functions... #declare A=0; #while (A -((BlowText_Max-BlowText_Min)/2).y | _Pos_y < ((BlowText_Max-BlowText_Min)/2).y) #declare Test_1 = BT_1(_Pos_x,_Pos_y,_Pos_z); #declare Test_2 = BT_2(_Pos_x,_Pos_y,_Pos_z); #if ( ((Test_1+.02 < Test_2) | (Test_1<.02)) & Test_1!=0) #local _Dif = ceil((Test_2-Test_1)*Max_Dust); #local B=0; #while (B<_Dif) //Adds a particle to the simulation Particle_Add("dust", array[5]{//Minimum size for array <0,1.5,Animation_Time*(clock-clock_delta*(B-1)/_Dif)>, // <0,0,0>, // _Pos-z*(.2+2*rand(SceneRand)), // Position <0,0,0>, // Velocity/Direction <1,1,1>*Test_1, //Color } ) #local B=B+1; #end #end #end #declare A=A+1; #end //Run particle simulation Parsys_Run() //Visualizes Particles with the Macro Show_Particles("dust","Dust_Particle") //Debugs amount of particles, the variable is declared by the particle system #debug concat("\n\n",str(Parsys_Stats_Active,0,0)," active Particles...\n")