home *** CD-ROM | disk | FTP | other *** search
- **************************************************************************
- **************************************************************************
- CLOCK MODIFIER INCLUDE FILE FOR PERSISTENCE OF VISION 3.x
- **************************************************************************
- **************************************************************************
-
- Created by Chris Colefax, 24 June 1997
-
- 1.0 INSTALLATION
- 2.0 QUICK START
- 3.0 CLOCK TYPES
- 3.1 Accelerate
- 3.2 Decelerate
- 3.3 S-Curve
- 3.4 Triangle
- 3.5 Jump
- 3.6 Bounce
- 3.7 Oscillate
- 3.8 Wave
- 3.9 Recoil
-
- 4.0 CLOCK MODIFICATION OPTIONS
- 4.1 clock_start & clock_finish
- 4.2 clock_repeat
- 4.3 clock_strength
- 4.4 clock_combine
-
- 5.0 USING THE CLOCK MODIFICATION PREVIEW
- 5.1 graph_continuous
- 5.2 graph_thickness
- 5.3 graph_smoothness
-
- 6.0 USING THE mclock VARIABLE
- 6.1 TRANSLATING OBJECTS
- 6.2 OTHER TRANSFORMATIONS
- 6.3 PIGMENTS AND OTHER ATTRIBUTES
-
- 7.0 CONTACTING THE AUTHOR
-
- **************************************************************************
-
-
- 1.0 INSTALLATION
- **************************************************************************
- The Clock Modifier consists of two files, ClockMod.inc and ClockP.inc
- which should be copied to one of the directories (folders) in your POVRay
- library path. Normally this is the INCLUDE sub-directory of the directory
- where you installed POVRay, so if you installed POVRay in C:\POVRAY you
- should copy the ClockMod.inc file to C:\POVRAY\INCLUDE. On a Windows 95
- system, this is probably something like:
-
- C:\Program Files\POV-Ray for Windows\Include
-
- On UNIX and similar systems, where filenames are case-sensitive, you may
- have to rename the include files so the capitals and lowercase are as
- shown above. This will enable you to render the sample files without
- modification.
-
-
- 2.0 QUICK START
- **************************************************************************
- POVRay animation is usually achieved using the clock variable. While this
- concept is quite simple, it can also be very frustrating. Even trying to
- animate the most basic of scenes often requires you to know and use a lot
- of complicated mathematical functions. With the Clock Modifier include
- file you can choose from a whole variety of different clock types, such
- as Acceleration, Deceleration, Recoil, and Bounce, and use them to animate
- objects, light_sources, etc. in all sorts of different ways. Using a
- modified clock value is as simple as declaring the name of the desired
- modification, and then including ClockMod.inc, eg:
-
- #declare clock_type = "Wave"
- #include "ClockMod.inc"
-
- In addition there are a variety of other options than can be used to
- modify and combine different clock types. To use any of these just add
- the following line to your scene file, BEFORE including ClockMod.inc:
-
- #declare [variable-name] = [value]
-
- substituting the desired variable name and value where appropriate.
- The Clock Modifier include file will then create a new variable, mclock,
- that can be used to scale, rotate, and translate objects, as well as
- alter their pigments and other attributes, eg:
-
- object {MyObject
- #declare clock_type = "Bounce"
- translate y * mclock * 10}
-
- Note that ClockMod.inc should NEVER be included at the start of a scene
- (like "colors.inc" or "textures.inc"). It should only be included
- after declaring the desired clock type and options. To use the Clock
- Modifier more than once in a scene, you should declare the first set of
- options and include "ClockMod.inc". Then declare the next set of options
- and include "ClockMod.inc" again.
-
-
- 3.0 CLOCK TYPES
- **************************************************************************
-
- The Clock Modifier include file allows you to use nine different clock
- types, as listed below. To use a particular clock type, you must first
- declare the clock_type variable as the name of the desired type. Note
- that you only have to use the first letter of a particular type, eg:
-
- #declare clock_type = "O"
-
- rather than #declare clock_type = "Oscillation". You can preview all of
- the available clock types by rendering the Preview.pov scene.
-
- 3.1 ACCELERATE
- ***************
- This clock type starts out slow and then gradually speeds up. This is
- very useful for animating moving objects. You can adjust the rate of
- acceleration using the clock_strength option (see below). See the
- Anim1.pov scene for an example of this clock type.
-
- 3.2 DECELERATE
- ***************
- This clock type starts out fast and then slows down. You can adjust
- the rate of deceleration using the clock_strength variable. See the
- Anim1.pov scene for an example of this clock type.
-
- 3.3 S-CURVE
- ************
- This clock type is like a combination of acceleration and deceleration;
- it starts out slow, speeds up, and then slows down again. It had many
- uses, such as smoothly changing the colour of an object (see the Anim3.pov
- scene for an example).
-
- 3.4 TRIANGLE
- *************
- This clock type rises and then falls again, with sharp changes of
- direction. It can be used to make objects pulsate (see the Anim2.pov scene
- for an example).
-
- 3.5 JUMP
- *********
- This clock type is similar to the Triangle clock type, but it slows down
- as it rises, and then speeds up again as it falls (the change of direction
- at the top is smooth). The clock_strength option can be used to adjust
- the rate of acceleration/deceleration. See the Anim3.pov scene for an
- example of this clock type.
-
- 3.6 BOUNCE
- ***********
- As the name suggests, this clock type can be used to make objects bounce.
- It starts out high, than falls and bounces back. The clock_strength option
- can be used to adjust the rate of acceleration/deceleration. See then
- Anim2.pov scene for an example of this clock type.
-
- 3.7 OSCILLATE
- **************
- This clock type starts at 0, then rises to 1. It then falls to -1, and
- rises again to 0. It can be used to oscillate all sorts of objects (see
- the Anim2.pov scene for an example).
-
- 3.8 WAVE
- *********
- This clock type is similar to the Oscillate clock type, but it starts at 0,
- rises to 1, and then falls back to 0. See then Anim1.pov scene for an
- example of this clock type.
-
- 3.9 RECOIL
- ***********
- This clock type can be used to animate all sorts of recoiling objects, such
- as firing guns, etc. The clock_strength option can be used to alter the
- rate of recoil. See the Anim3.pov scene for an example of this clock type.
-
-
- 4.0 CLOCK MODIFICATION OPTIONS
- **************************************************************************
- The nine basic clock modification types can be altered using the following
- variables.
-
- 4.1 clock_start & clock_finish
- *******************************
- Normally the POVRay internal clock starts at 0 (at the beginning of the
- animation) and ends at 1. If you are using different clock values, you
- can set these using the clock_start and clock_finish variables, eg:
-
- #declare clock_start = 0
- #declare clock_finish = 100
-
- You can also use these variables to make a particular modification occupy
- only part of a scene, eg:
-
- #declare clock_type = "Accelerate"
- #declare clock_start = .7
-
- will only start accelerating 70% of the way through the animation.
-
- 4.2 clock_repeat
- *****************
- You can use this option to make a particular modification repeat itself
- during the course of an animation, eg:
-
- #declare clock_type = "Recoil"
- #declare clock_repeat = 10
-
- could be used to make a cannon fire 10 times.
-
- 4.3 clock_strength
- *******************
- This option can be used to alter the rate of acceleration/deceleration of
- the following clock types: Accelerate, Decelerate, Jump, Bounce and Recoil.
- The default value is 1; numbers larger than this will increase the rate,
- while numbers smaller than 1 will decrease the rate, eg:
-
- #declare clock_type = "Jump"
- #declare clock_strength = 2
-
- will make the bouncing motion more apparent.
-
- 4.4 clock_combine
- ******************
- This option can be used to combine one clock type with another. This is
- most useful when using a repeated Wave or similar, eg:
-
- #declare clock_type = "Wave"
- #declare clock_repeat = 10
-
- will give 10 waves, each taking the same length of time. If you wanted the
- waves to get quicker as time passed, you could combine the above with an
- Accelerate, eg:
-
- #declare clock_combine = "Accelerate"
-
- The Combine.pov scene shows how this option works. Note that if you using
- the Clock Modification include file more than once in a scene, and you have
- used clock_combine once but don't want to use it again, you should declare
- is as "", eg:
-
- #declare clock_type = "Wave" #declare clock_combine = "Accelerate"
- #include "ClockMod.inc"
-
- #declare clock_combine = ""
-
-
- 5.0 USING THE CLOCK MODIFICATION PREVIEW
- **************************************************************************
- When using a variety of the above options (especially the clock_combine
- option) it can be very useful to see a graph of the mclock variable. You
- use achieve this using the ClockP.inc file; first declare the desired
- clock options, and then include the ClockP.inc file (DO NOT include the
- ClockMod.inc file), eg:
-
- #declare clock_type = "Recoil" #declare clock_repeat = 3
- #declare clock_combine = "Decelerate" #declare clock_strength = 2
- #include "ClockP.inc"
-
- No other cameras, lights, or objects are necessary, though the following
- options can be used to control the clock preview.
-
- 5.1 graph_continuous
- *********************
- Normally the graph is plotted using spheres. If you would prefer an
- unbroken line graph, use this option, eg:
-
- #declare graph_continuous = true
-
- 5.2 graph_thickness
- ********************
- Use this option to change the thickness of the line graph, eg:
-
- #declare graph_thickness = .01
-
- The default for graph_thickness is .02
-
- 5.3 graph_smoothness
- *********************
- Use this option to alter the number of points plotted on the graph, eg:
-
- #declare graph_smoothness = 250
-
- The default is 100. Increasing this option will make the graph more
- accurate, and is useful when you have a very complex graph (eg. many
- repeated oscillations).
-
-
- 6.0 USING THE mclock VARIABLE
- **************************************************************************
- This section contains a basic explanation of how to use the mclock
- variable to modify different objects in a variety of ways.
-
- 6.1 TRANSLATING OBJECTS
- ************************
- Animations generally involve movement of some kind. The simplest way
- to move an object (or light_source, camera, etc.) is to use the translate
- command, eg:
-
- object {MyObject translate <10, 10, -10>}
-
- This will move the specified object 10 units along the x-axis, 10 units
- up the y-axis, and -10 units along the z-axis. If you wanted to animate
- the object, so that it started at its current position, and then
- accelerated to it's new position, you would use:
-
- object {MyObject
- #declare clock_type = "Accelerate"
- #include "ClockMod.inc"
- translate <10, 10, -10> * mclock}
-
- Note that you can add translations together, so you can first create your
- object at the origin, then animate it, and finally move it into the correct
- position, eg:
-
- sphere {<0, 0, 0>, 1
- pigment {color Red}
- #declare clock_type = "Bounce"
- #include "ClockMod.inc"
- translate y * mclock * 5
- translate <10, 1, 20>}
-
- This will create a red sphere that bounces 5 units high (up the y-axis),
- and bounces on the spot located at <10, 1, 20>.
-
- 6.2 OTHER TRANSFORMATIONS
- **************************
- You can use mclock with rotate and scale in the same way as with
- translate, eg:
-
- object {MyObject
- #declare clock_type = "Jump"
- #include "ClockMod.inc"
- scale mclock * 2
-
- #declare clock_type = "Oscillate"
- #include "ClockMod.inc"
- rotate y * 50 * mclock}
-
- This will make the object pulsate between its normal size and double its
- size, and also rotate back and forth 50 degrees around the y-axis.
-
- 6.3 PIGMENTS AND OTHER ATTRIBUTES
- **********************************
- In addition to the transformation above, you can use the mclock variable
- with any POVRay attribute that requires a number. An example of this is
- pigments, eg. to make a flashing blue light:
-
- light_source {<10, 30, -20>
- #declare clock_type = "Wave"
- #declare clock_repeat = 20
- #include "ClockMod.inc"
- color Blue * mclock}
-
- The mclock variable can also be used in the pigment, normal and finish
- statements of objects, as well as when animating camera angles, etc.
- Often you will want to go from one value to another, eg. changing an
- object from Red to Green. To do this, use the following commands:
-
- #declare clock_type = "S-Curve"
- #include "ClockMod.inc"
- pigment {Red + mclock * (Green - Red)}
-
- As you can see, you start with the first value, and then add mclock
- multiplied by the different between the two values (which is always the
- second value take away the first value). If you wanted to make an object
- become less reflective during an animation, you could use:
-
- #declare clock_type = "Decelerate"
- #include "ClockMod.inc"
- finish {reflection .8 + mclock * (.2 - .8)}
-
- This will change the reflection from .8 at the start of the animation, down
- to .2 at the end.
-
-
- 7.0 CONTACTING THE AUTHOR
- **************************************************************************
- If you wish to contact me with bug reports, bug fixes, criticisms,
- comments, suggested improvements, questions, etc. you can reach me by
- email at:
-
- ccolefax@geocities.com
-
- or by regular mail at:
-
- Chris Colefax
- PO Box 110
- Kuranda, Queensland
- Australia 4872
-
- **************************************************************************
-
- POV-Ray(tm) and Persistence of Vision(tm) are registered trademarks of the
- POV-Ray Team(tm)
-