home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / particle / part6.pi < prev    next >
Encoding:
Text File  |  1994-12-31  |  3.3 KB  |  150 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.    max_trace_depth 20
  24.    antialias 1
  25.    }
  26.  
  27. background <0, 0, 0>
  28. light <-10, 30, -20>
  29.  
  30. include "../../colors.inc"
  31.  
  32. if (frame == start_frame)
  33.    include "part6tex.inc"
  34.  
  35. // emission_position and emission_magnitude are used within a particle
  36. // generator, so they are noeval.  Note that since "t" is used within
  37. // these expressions, it must also be declared noeval.
  38. define noeval emission_position <8 * sin(radians(720 * t)), 0, 0>
  39. define noeval emission_magnitude 1.5 + 0.5 * cos(radians(4*360 * t))
  40.  
  41. // define chimny
  42. object {
  43.      object { cone <0, 0, 0>, 1, <0, 1, 0>, 0.5 }
  44.    + object { disc <0, 1, 0>, <0, 1, 0>, 0.3, 0.5 }
  45.    translate emission_position
  46.    }
  47.  
  48. // The force of gravity
  49. define gravity <0, -1, 0>
  50.  
  51. // Define the emmisions from the chimny
  52. if (frame == start_frame) {
  53.    static define part9
  54.    particle {
  55.       death (u > 0.1 ? 1 : 0)
  56.       position P
  57.       velocity I
  58.       object "bsphere9"
  59.       count 1
  60.       }
  61.  
  62.    static define part8
  63.    particle {
  64.       death (u > 0.1 ? "part9" : 0)
  65.       position P
  66.       velocity I
  67.       object "bsphere8"
  68.       count 1
  69.       }
  70.  
  71.    static define part7
  72.    particle {
  73.       death (u > 0.1 ? "part8" : 0)
  74.       position P
  75.       velocity I
  76.       object "bsphere7"
  77.       count 1
  78.       }
  79.  
  80.    static define part6
  81.    particle {
  82.       death (u > 0.1 ? "part7" : 0)
  83.       position P
  84.       velocity I
  85.       object "bsphere6"
  86.       count 1
  87.       }
  88.  
  89.    static define part5
  90.    particle {
  91.       death (u > 0.1 ? "part6" : 0)
  92.       position P
  93.       velocity I
  94.       object "bsphere5"
  95.       count 1
  96.       }
  97.  
  98.    static define part4
  99.    particle {
  100.       death (u > 0.1 ? "part5" : 0)
  101.       position P
  102.       velocity I
  103.       object "bsphere4"
  104.       count 1
  105.       }
  106.  
  107.    static define part3
  108.    particle {
  109.       death (u > 0.1 ? "part4" : 0)
  110.       position P
  111.       velocity I
  112.       object "bsphere3"
  113.       count 1
  114.       }
  115.  
  116.    static define part2
  117.    particle {
  118.       death (u > 0.1 ? "part3" : 0)
  119.       position P
  120.       velocity I
  121.       object "bsphere2"
  122.       count 1
  123.       }
  124.  
  125.    static define part1
  126.    particle {
  127.       death (u > 0.1 ? "part2" : 0)
  128.       position P
  129.       velocity I
  130.       object "bsphere1"
  131.       count 1
  132.       }
  133.  
  134.    // define starting particle system for spewing smoke
  135.    particle {
  136.       birth 1                 // Particles are created every frame
  137.       death (u > 0.1 ? "part1" : 0) // They change form after 3 frames
  138.       position emission_position + <0, 1, 0>
  139.       velocity emission_magnitude * brownian(<0, 0, 0>, <1, 1, 1>) + <0, 0.5, 0>
  140.       object "bsphere0"
  141.       count 5
  142.       }
  143.    }
  144.  
  145. object {
  146.    polygon 4, <-10, 0,-10>, <-10, 0, 10>, < 10, 0, 10>, < 10, 0,-10>
  147.    texture { checker matte_yellow, texture { matte { color coral } }
  148.          scale 2.5*white }
  149.    }
  150.