home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / particle / part5.pi < prev    next >
Encoding:
Text File  |  1994-12-31  |  3.0 KB  |  113 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 tex1 texture { special shiny { color <0, 0, 1> } }
  31. define tex2 texture { special shiny { color <0.25, 0, 0.75> } }
  32. define tex3 texture { special shiny { color <0.5, 0, 0.5> } }
  33. define tex4 texture { special shiny { color <0.75, 0, 0.25> } }
  34. define tex5 texture { special shiny { color <1, 0, 0> } }
  35.  
  36. define bsphere1 object { sphere <0, 0, 0>, 0.2 tex1 uv_steps 6, 3 }
  37. define bsphere2 object { sphere <0, 0, 0>, 0.3 tex2 uv_steps 6, 3 }
  38. define bsphere3 object { sphere <0, 0, 0>, 0.4 tex3 uv_steps 6, 3 }
  39. define bsphere4 object { sphere <0, 0, 0>, 0.5 tex4 uv_steps 6, 3 }
  40. define bsphere5 object { sphere <0, 0, 0>, 0.6 tex5 uv_steps 6, 3 }
  41.  
  42. // emission_position and emission_magnitude are used within a particle
  43. // generator, so they are noeval.  Note that since "t" is used within
  44. // these expressions, it must also be declared noeval.
  45. define noeval emission_position <8 * sin(radians(720 * t)), 0, 0>
  46. define noeval emission_magnitude 1.5 + 0.5 * cos(radians(4*360 * t))
  47.  
  48. // define chimny
  49. object {
  50.      object { cone <0, 0, 0>, 1, <0, 1, 0>, 0.5 }
  51.    + object { disc <0, 1, 0>, <0, 1, 0>, 0.3, 0.5 }
  52.    translate emission_position
  53.    }
  54.  
  55. // The force of gravity
  56. define gravity <0, -1, 0>
  57.  
  58. // Define the emmisions from the chimny
  59. if (frame == start_frame) {
  60.    static define part5
  61.    particle {
  62.       death (u > 0.3 ? 1 : 0)
  63.       position P
  64.       velocity I
  65.       object "bsphere5"
  66.       count 1
  67.       }
  68.  
  69.    static define part4
  70.    particle {
  71.       death (u > 0.3 ? "part5" : 0)
  72.       position P
  73.       velocity I
  74.       object "bsphere4"
  75.       count 1
  76.       }
  77.  
  78.    static define part3
  79.    particle {
  80.       death (u > 0.3 ? "part4" : 0)
  81.       position P
  82.       velocity I
  83.       object "bsphere3"
  84.       count 1
  85.       }
  86.  
  87.    static define part2
  88.    particle {
  89.       death (u > 0.3 ? "part3" : 0)
  90.       position P
  91.       velocity I
  92.       object "bsphere2"
  93.       count 1
  94.       }
  95.  
  96.    // define starting particle system for spewing smoke
  97.    particle {
  98.       birth 1                 // Particles are created every frame
  99.       death (u > 0.3 ? "part2" : 0) // They change form after 3 frames
  100.       position emission_position + <0, 1, 0>
  101.       velocity emission_magnitude * brownian(<0, 0, 0>, <1, 1, 1>)
  102.       object "bsphere1"
  103.       count 10
  104.       }
  105.    }
  106.  
  107. /*
  108. object {
  109.    polygon 4, <-10, 0,-10>, <-10, 0, 10>, < 10, 0, 10>, < 10, 0,-10>
  110.    matte_yellow
  111.    }
  112. */
  113.