home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / CLOCKMOD.ZIP / CLOCKMOD.TXT < prev    next >
Encoding:
Text File  |  1997-06-24  |  13.9 KB  |  388 lines

  1. **************************************************************************
  2. **************************************************************************
  3.         CLOCK MODIFIER INCLUDE FILE FOR PERSISTENCE OF VISION 3.x
  4. **************************************************************************
  5. **************************************************************************
  6.  
  7. Created by Chris Colefax, 24 June 1997
  8.  
  9. 1.0  INSTALLATION
  10. 2.0  QUICK START
  11. 3.0  CLOCK TYPES
  12.         3.1  Accelerate
  13.         3.2  Decelerate
  14.         3.3  S-Curve
  15.         3.4  Triangle
  16.         3.5  Jump
  17.         3.6  Bounce
  18.         3.7  Oscillate
  19.         3.8  Wave
  20.         3.9  Recoil
  21.  
  22. 4.0  CLOCK MODIFICATION OPTIONS
  23.         4.1  clock_start & clock_finish
  24.         4.2  clock_repeat
  25.         4.3  clock_strength
  26.         4.4  clock_combine
  27.  
  28. 5.0  USING THE CLOCK MODIFICATION PREVIEW
  29.         5.1  graph_continuous
  30.         5.2  graph_thickness
  31.         5.3  graph_smoothness
  32.  
  33. 6.0  USING THE mclock VARIABLE
  34.         6.1  TRANSLATING OBJECTS
  35.         6.2  OTHER TRANSFORMATIONS
  36.         6.3  PIGMENTS AND OTHER ATTRIBUTES
  37.  
  38. 7.0  CONTACTING THE AUTHOR
  39.  
  40. **************************************************************************
  41.  
  42.  
  43. 1.0  INSTALLATION
  44. **************************************************************************
  45. The Clock Modifier consists of two files, ClockMod.inc and ClockP.inc
  46. which should be copied to one of the directories (folders) in your POVRay
  47. library path.  Normally this is the INCLUDE sub-directory of the directory
  48. where you installed POVRay, so if you installed POVRay in C:\POVRAY you
  49. should copy the ClockMod.inc file to C:\POVRAY\INCLUDE.  On a Windows 95
  50. system, this is probably something like:
  51.  
  52.    C:\Program Files\POV-Ray for Windows\Include
  53.  
  54. On UNIX and similar systems, where filenames are case-sensitive, you may
  55. have to rename the include files so the capitals and lowercase are as
  56. shown above.  This will enable you to render the sample files without
  57. modification.
  58.  
  59.  
  60. 2.0  QUICK START
  61. **************************************************************************
  62. POVRay animation is usually achieved using the clock variable. While this
  63. concept is quite simple, it can also be very frustrating.  Even trying to
  64. animate the most basic of scenes often requires you to know and use a lot
  65. of complicated mathematical functions.  With the Clock Modifier include
  66. file you can choose from a whole variety of different clock types, such
  67. as Acceleration, Deceleration, Recoil, and Bounce, and use them to animate
  68. objects, light_sources, etc. in all sorts of different ways.  Using a
  69. modified clock value is as simple as declaring the name of the desired
  70. modification, and then including ClockMod.inc, eg:
  71.  
  72.    #declare clock_type = "Wave"
  73.    #include "ClockMod.inc"
  74.  
  75. In addition there are a variety of other options than can be used to
  76. modify and combine different clock types.  To use any of these just add
  77. the following line to your scene file, BEFORE including ClockMod.inc:
  78.  
  79.    #declare [variable-name] = [value]
  80.  
  81. substituting the desired variable name and value where appropriate.
  82. The Clock Modifier include file will then create a new variable, mclock,
  83. that can be used to scale, rotate, and translate objects, as well as
  84. alter their pigments and other attributes, eg:
  85.  
  86.    object {MyObject
  87.       #declare clock_type = "Bounce"
  88.       translate y * mclock * 10}
  89.  
  90. Note that ClockMod.inc should NEVER be included at the start of a scene
  91. (like "colors.inc" or "textures.inc").  It should only be included
  92. after declaring the desired clock type and options.  To use the Clock
  93. Modifier more than once in a scene, you should declare the first set of
  94. options and include "ClockMod.inc".  Then declare the next set of options
  95. and include "ClockMod.inc" again.
  96.  
  97.  
  98. 3.0  CLOCK TYPES
  99. **************************************************************************
  100.  
  101. The Clock Modifier include file allows you to use nine different clock
  102. types, as listed below.  To use a particular clock type, you must first
  103. declare the clock_type variable as the name of the desired type.  Note
  104. that you only have to use the first letter of a particular type, eg:
  105.  
  106.    #declare clock_type = "O"
  107.  
  108. rather than #declare clock_type = "Oscillation".  You can preview all of
  109. the available clock types by rendering the Preview.pov scene.
  110.  
  111. 3.1  ACCELERATE
  112. ***************
  113. This clock type starts out slow and then gradually speeds up.  This is
  114. very useful for animating moving objects.  You can adjust the rate of
  115. acceleration using the clock_strength option (see below).  See the
  116. Anim1.pov scene for an example of this clock type.
  117.  
  118. 3.2  DECELERATE
  119. ***************
  120. This clock type starts out fast and then slows down.  You can adjust
  121. the rate of deceleration using the clock_strength variable.  See the
  122. Anim1.pov scene for an example of this clock type.
  123.  
  124. 3.3  S-CURVE
  125. ************
  126. This clock type is like a combination of acceleration and deceleration;
  127. it starts out slow, speeds up, and then slows down again.  It had many
  128. uses, such as smoothly changing the colour of an object (see the Anim3.pov
  129. scene for an example).
  130.  
  131. 3.4  TRIANGLE
  132. *************
  133. This clock type rises and then falls again, with sharp changes of
  134. direction.  It can be used to make objects pulsate (see the Anim2.pov scene
  135. for an example).
  136.  
  137. 3.5  JUMP
  138. *********
  139. This clock type is similar to the Triangle clock type, but it slows down
  140. as it rises, and then speeds up again as it falls (the change of direction
  141. at the top is smooth).  The clock_strength option can be used to adjust
  142. the rate of acceleration/deceleration.  See the Anim3.pov scene for an
  143. example of this clock type.
  144.  
  145. 3.6  BOUNCE
  146. ***********
  147. As the name suggests, this clock type can be used to make objects bounce.
  148. It starts out high, than falls and bounces back.  The clock_strength option
  149. can be used to adjust the rate of acceleration/deceleration.  See then
  150. Anim2.pov scene for an example of this clock type.
  151.  
  152. 3.7  OSCILLATE
  153. **************
  154. This clock type starts at 0, then rises to 1.  It then falls to -1, and
  155. rises again to 0.  It can be used to oscillate all sorts of objects (see
  156. the Anim2.pov scene for an example).
  157.  
  158. 3.8  WAVE
  159. *********
  160. This clock type is similar to the Oscillate clock type, but it starts at 0,
  161. rises to 1, and then falls back to 0.  See then Anim1.pov scene for an
  162. example of this clock type.
  163.  
  164. 3.9  RECOIL
  165. ***********
  166. This clock type can be used to animate all sorts of recoiling objects, such
  167. as firing guns, etc.  The clock_strength option can be used to alter the
  168. rate of recoil.  See the Anim3.pov scene for an example of this clock type.
  169.  
  170.  
  171. 4.0  CLOCK MODIFICATION OPTIONS
  172. **************************************************************************
  173. The nine basic clock modification types can be altered using the following
  174. variables.
  175.  
  176. 4.1  clock_start & clock_finish
  177. *******************************
  178. Normally the POVRay internal clock starts at 0 (at the beginning of the
  179. animation) and ends at 1.  If you are using different clock values, you
  180. can set these using the clock_start and clock_finish variables, eg:
  181.  
  182.    #declare clock_start = 0
  183.    #declare clock_finish = 100
  184.  
  185. You can also use these variables to make a particular modification occupy
  186. only part of a scene, eg:
  187.  
  188.    #declare clock_type = "Accelerate"
  189.    #declare clock_start = .7
  190.  
  191. will only start accelerating 70% of the way through the animation.
  192.  
  193. 4.2  clock_repeat
  194. *****************
  195. You can use this option to make a particular modification repeat itself
  196. during the course of an animation, eg:
  197.  
  198.    #declare clock_type = "Recoil"
  199.    #declare clock_repeat = 10
  200.  
  201. could be used to make a cannon fire 10 times.
  202.  
  203. 4.3  clock_strength
  204. *******************
  205. This option can be used to alter the rate of acceleration/deceleration of
  206. the following clock types: Accelerate, Decelerate, Jump, Bounce and Recoil.
  207. The default value is 1; numbers larger than this will increase the rate,
  208. while numbers smaller than 1 will decrease the rate, eg:
  209.  
  210.    #declare clock_type = "Jump"
  211.    #declare clock_strength = 2
  212.  
  213. will make the bouncing motion more apparent.
  214.  
  215. 4.4  clock_combine
  216. ******************
  217. This option can be used to combine one clock type with another.  This is
  218. most useful when using a repeated Wave or similar, eg:
  219.  
  220.    #declare clock_type = "Wave"
  221.    #declare clock_repeat = 10
  222.  
  223. will give 10 waves, each taking the same length of time.  If you wanted the
  224. waves to get quicker as time passed, you could combine the above with an
  225. Accelerate, eg:
  226.  
  227.    #declare clock_combine = "Accelerate"
  228.  
  229. The Combine.pov scene shows how this option works.  Note that if you using
  230. the Clock Modification include file more than once in a scene, and you have
  231. used clock_combine once but don't want to use it again, you should declare
  232. is as "", eg:
  233.  
  234.    #declare clock_type = "Wave" #declare clock_combine = "Accelerate"
  235.    #include "ClockMod.inc"
  236.  
  237.    #declare clock_combine = ""
  238.  
  239.  
  240. 5.0  USING THE CLOCK MODIFICATION PREVIEW
  241. **************************************************************************
  242. When using a variety of the above options (especially the clock_combine
  243. option) it can be very useful to see a graph of the mclock variable.  You
  244. use achieve this using the ClockP.inc file; first declare the desired
  245. clock options, and then include the ClockP.inc file (DO NOT include the
  246. ClockMod.inc file), eg:
  247.  
  248.    #declare clock_type = "Recoil" #declare clock_repeat = 3
  249.    #declare clock_combine = "Decelerate" #declare clock_strength = 2
  250.    #include "ClockP.inc"
  251.  
  252. No other cameras, lights, or objects are necessary, though the following
  253. options can be used to control the clock preview.
  254.  
  255. 5.1  graph_continuous
  256. *********************
  257. Normally the graph is plotted using spheres.  If you would prefer an
  258. unbroken line graph, use this option, eg:
  259.  
  260.    #declare graph_continuous = true
  261.  
  262. 5.2  graph_thickness
  263. ********************
  264. Use this option to change the thickness of the line graph, eg:
  265.  
  266.    #declare graph_thickness = .01
  267.  
  268. The default for graph_thickness is .02
  269.  
  270. 5.3  graph_smoothness
  271. *********************
  272. Use this option to alter the number of points plotted on the graph, eg:
  273.  
  274.    #declare graph_smoothness = 250
  275.  
  276. The default is 100.  Increasing this option will make the graph more
  277. accurate, and is useful when you have a very complex graph (eg. many
  278. repeated oscillations).
  279.  
  280.  
  281. 6.0  USING THE mclock VARIABLE
  282. **************************************************************************
  283. This section contains a basic explanation of how to use the mclock
  284. variable to modify different objects in a variety of ways.
  285.  
  286. 6.1  TRANSLATING OBJECTS
  287. ************************
  288. Animations generally involve movement of some kind.  The simplest way
  289. to move an object (or light_source, camera, etc.) is to use the translate
  290. command, eg:
  291.  
  292.    object {MyObject translate <10, 10, -10>}
  293.  
  294. This will move the specified object 10 units along the x-axis, 10 units
  295. up the y-axis, and -10 units along the z-axis.  If you wanted to animate
  296. the object, so that it started at its current position, and then
  297. accelerated to it's new position, you would use:
  298.  
  299.    object {MyObject
  300.       #declare clock_type = "Accelerate"
  301.       #include "ClockMod.inc"
  302.       translate <10, 10, -10> * mclock}
  303.  
  304. Note that you can add translations together, so you can first create your
  305. object at the origin, then animate it, and finally move it into the correct
  306. position, eg:
  307.  
  308.     sphere {<0, 0, 0>, 1
  309.        pigment {color Red}
  310.        #declare clock_type = "Bounce"
  311.        #include "ClockMod.inc"
  312.        translate y * mclock * 5
  313.        translate <10, 1, 20>}
  314.  
  315. This will create a red sphere that bounces 5 units high (up the y-axis),
  316. and bounces on the spot located at <10, 1, 20>.
  317.  
  318. 6.2  OTHER TRANSFORMATIONS
  319. **************************
  320. You can use mclock with rotate and scale in the same way as with
  321. translate, eg:
  322.  
  323.    object {MyObject
  324.       #declare clock_type = "Jump"
  325.       #include "ClockMod.inc"
  326.       scale mclock * 2
  327.  
  328.       #declare clock_type = "Oscillate"
  329.       #include "ClockMod.inc"
  330.       rotate y * 50 * mclock}
  331.  
  332. This will make the object pulsate between its normal size and double its
  333. size, and also rotate back and forth 50 degrees around the y-axis.
  334.  
  335. 6.3  PIGMENTS AND OTHER ATTRIBUTES
  336. **********************************
  337. In addition to the transformation above, you can use the mclock variable
  338. with any POVRay attribute that requires a number.  An example of this is
  339. pigments, eg. to make a flashing blue light:
  340.  
  341.    light_source {<10, 30, -20>
  342.       #declare clock_type = "Wave"
  343.       #declare clock_repeat = 20
  344.       #include "ClockMod.inc"
  345.       color Blue * mclock}
  346.  
  347. The mclock variable can also be used in the pigment, normal and finish
  348. statements of objects, as well as when animating camera angles, etc.
  349. Often you will want to go from one value to another, eg. changing an
  350. object from Red to Green.  To do this, use the following commands:
  351.  
  352.    #declare clock_type = "S-Curve"
  353.    #include "ClockMod.inc"
  354.    pigment {Red + mclock * (Green - Red)}
  355.  
  356. As you can see, you start with the first value, and then add mclock
  357. multiplied by the different between the two values (which is always the
  358. second value take away the first value).  If you wanted to make an object
  359. become less reflective during an animation, you could use:
  360.  
  361.    #declare clock_type = "Decelerate"
  362.    #include "ClockMod.inc"
  363.    finish {reflection .8 + mclock * (.2 - .8)}
  364.  
  365. This will change the reflection from .8 at the start of the animation, down
  366. to .2 at the end.
  367.  
  368.  
  369. 7.0  CONTACTING THE AUTHOR
  370. **************************************************************************
  371. If you wish to contact me with bug reports, bug fixes, criticisms, 
  372. comments, suggested improvements, questions, etc. you can reach me by 
  373. email at:
  374.  
  375.    ccolefax@geocities.com
  376.  
  377. or by regular mail at:
  378.  
  379.    Chris Colefax
  380.    PO Box 110
  381.    Kuranda, Queensland
  382.    Australia  4872
  383.  
  384. **************************************************************************
  385.  
  386. POV-Ray(tm) and Persistence of Vision(tm) are registered trademarks of the
  387. POV-Ray Team(tm)
  388.