home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / particle / part4.pi < prev    next >
Encoding:
Text File  |  1994-12-31  |  1.7 KB  |  67 lines

  1. // Simple particle system
  2. // Polyray input file: Alexander Enzmann
  3.  
  4. frame_time 0.1
  5. start_frame 0
  6. end_frame 60
  7. total_frames 61
  8.  
  9. // The variable t must be declared "noeval" in order to use it in
  10. // expressions that are within a particle generator.  If we didn't use
  11. // noeval, all the particles would end up being emitted from the exact
  12. // same location.
  13. define noeval t frame / total_frames
  14.  
  15. // Set up the camera
  16. viewpoint {
  17.    from <0,8,-10>
  18.    at <0,2,0>
  19.    up <0,1,0>
  20.    angle 55
  21.    resolution 320, 160
  22.    aspect 2
  23.    }
  24.  
  25. background <0, 0, 0>
  26. light <-10, 30, -20>
  27.  
  28. include "../../colors.inc"
  29.  
  30. define asphere object { sphere <0, 0, 0>, 0.4 shiny_red uv_steps 6, 3 }
  31. define bsphere object { sphere <0, 0, 0>, 0.4 shiny_blue uv_steps 6, 3 }
  32.  
  33. // emission_position and emission_magnitude are used within a particle
  34. // generator, so they are noeval.  Note that since "t" is used within
  35. // these expressions, it must also be declared noeval.
  36. define noeval emission_position <8 * sin(radians(720 * t)), 0, 0>
  37. define noeval emission_magnitude 1.5 + 0.5 * cos(radians(4*360 * t))
  38.  
  39. // define chimny
  40. object {
  41.      object { cone <0, 0, 0>, 1, <0, 1, 0>, 0.5 }
  42.    + object { disc <0, 1, 0>, <0, 1, 0>, 0.3, 0.5 }
  43.    translate emission_position
  44.    }
  45.  
  46. // The force of gravity
  47. define gravity <0, -1, 0>
  48.  
  49. // Define the emmisions from the chimny
  50. if (frame == start_frame)
  51. // define chimny_particle
  52. particle {
  53.    birth 1
  54.    death (y < 0 ? 1 : 0)
  55.    avoid 1
  56.    position emission_position + <0, 1, 0>
  57.    velocity emission_magnitude * brownian(<0, 0, 0>, <1, 1, 1>)
  58.    acceleration gravity
  59.    object "bsphere"
  60.    count 10
  61.    }
  62.  
  63. object {
  64.    polygon 4, <-10, 0,-10>, <-10, 0, 10>, < 10, 0, 10>, < 10, 0,-10>
  65.    matte_yellow
  66.    }
  67.