[Home]

[Dave G's Animation System]

[Download]

[Links]

Welcome to the world of Particles for POV-Ray

If you've ever wanted to automatically have objects appear, dissappear, and move then you might find this particle animation system very useful. I wrote Dave G's Particle Animation System (DGPAS) to automate most of the tasks involved with animating objects.

What I used to do...

I don't mind using POV-Ray's clock variable to make an object appear and dissappear throughout the course of an animation. For example, if I want an object to appear one quarter of the way through and dissappear after three quarters of the animation I could type:

#declare Object_Shown = false
#if ((clock >= 0.25) & (clock <= 0.75))
// now we can move an object
#declare Object_clock = (clock - 0.25)/0.5 // Gives 0 - 1
#end

But I find this a great deal of work. Especially when I have to do it for every object I want to appear.

And I don't mind moving an object along a path using the new clock variable. For example, after I declare Object_clock in the above example I could put:

#declare Start = <1,1,1>
#declare End = <5,5,4>
#declare New_Position = ((End - Start) / Object_clock) + Start
sphere { New_Position, 0.1 pigment { color Blue } }

But again, this is tedious and repetitious if I have to write out the math for every object I want to move.

What I did to solve the problem

What I really needed was a way to do all the math as whenever I wanted without having to write it all out. So I wrote a little include file that automated the task.

Since I was making a position appear or dissappear, and I was moving only a point in space, I called the include file a particle animation system. All I had to do was set some varaibles and include the file. I didn't even have to place the object into the scene myself. For example:

#declare DGPASObject =
sphere{ <0,0,0>, 0.1 pigment { color Blue } }
#declare DGPASInitial_Time = 0.25
#declare DGPASFinal_Time = 0.75
#declare DGPASStart_Point = <1,1,1>
#declare DGPASEnd_Point = <5,5,4>
#declare DGPASCommand = "MOVING_PARTICLE"
#include "DGPAS.INC"

- declare the object

- declare its creation time
- declare its destruction time
- declare its initial point in space
- declare its final position
- tell DGPAS to move the particle
- let DGPAS.INC do all the work

When DGPAS.INC takes over, it does all the work.

  1. It checks to see if the particle appears in this frame
  2. If it appears it figures out the particles clock value
  3. It then calculates where the particle is between the DGPASStart_Point and the DGPASEnd_Point
  4. It then translates DGPASObject to the correct location and places it in the scene.

And that was how DGPAS started.

And then I kept adding stuff...

As I started to use my new include file I found it had some weaknesses.

So I kept adding functions to DGPAS. And here is an overview, in no particular order:

Reset All Variables

I created the command "RESET" to set all variables back to standard defaults.

If you set a DGPAS variable, DGAS.INC will not alter its value. Therefore you can define a second particle by defining the changes from the previous one and including DGPAS.INC. But, this allows you to reset all DGPAS variables to known values. (If you loose track of previous settings).

This was also put in place for programs that generate POV-Ray code (such as scene builders and modellers). Resetting assures the software of the value of all the variables.

#declare DGPASCommand = "RESET"
#include "DGPAS.INC"

Place Objects Yourself

DGPASObject_Type controls whether DGPAS automatically places the DGPASObject into the scene.

// Place the object automatically
#declare DGPASObject_Type = "DECLARED"

// Place the object manually
#declare DGPASObject_Type = "USER"

Find Out Where to Place Objects

DGPAS returns variables telling you if the particle is alive, how far the particle is through its lifespan, and where the particle is positioned.

// Is the particle alive?
#if (DGPASParticle = true) ..... #end

// How far through its lifespan
DGPASParticle_Life

// The particle's location
DGPASCurrent_Point

Change the Time Scale

DGPASTime_Scale multiplies the clock variable to more manageable proportions.

#declare DGPASTime_Scale = 100
#declare DGPASInitial_Time = 25
#declare DGPASFinal_Time = 75

Make A Particle Stay Still

Particles can be declared as non-moving. If you plan on calculating the particles movement yourself, or if you are only using the particle as a timing device, this results in fewer calculations.

#declare DGPASCommand = "STILL_PARTICLE"

Give a Particle a Velocity

Particles can be declared as having an initial position and a velocity. This velocity is applied over the life of the particle (Using the Time_Scaled clock value).

#declare DGPASCommand = "VELOCITY_PARTICLE"
#declare DGPASStart_Point = <1,1,1>
#declare DGPASVelocity = <1,0,0.5>

Accelerate a Particle

You can give a particle an acceleration as well as a velocity and starting point.

#declare DGPASCommand = "VELOCITY_PARTICLE"
#declare DGPASStart_Point = <1,1,1>
#declare DGPASVelocity = <1,0,0.5>
#declare DGPASAcceleration = <0,1,0>

Fold a Particle Along An Axis

You can constrain a particle within two points on any axis. If the particles motion would move it outside these points it is 'folded' back in the opposite direction until it is within the constraints.

If you fold a particle along all 3 axis (X, Y, and Z) you are trapping a particle within a box. It will appear to bounce off of the walls as it travels.

#declare DGPASFold_X = true
#declare DGPASFold_X_Min = -5
#declare DGPASFold_X_Max = 5

Bounce a Particle

And you can cause a particle to bounce off of a point along one axis.

You can easily create bouncing objects. To make the object more realistic you can make each bounce be smaller than the last.

#declare DGPASCommand = "BOUNCE_PARTICLE"
#declare DGPASBounce_Plane = "Y"
#declare DGPASBounce_Point = 0
#declare DGPASResilience = 0.9
#declare DGPASStart_Point = <0,10,0>
#declare DGPASAcceleration = <0,-1,0>

And Then?

Well after all that adding I've taken a break long enough to write some documentation and let you help me test the file.

I do want to add more, but I don't want to make it too complicated to use. Adding features forever doesn't appeal to me. Making the system more powerful does.

And if you have any suggestions let me know!

Good Luck rendering!

[ Go Home ]

Hosted by Geocities, your free personal home page on the web.

This page copyright David Govoni 1997

Any comments, or suggestions?
E-mail me
.

1