home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / misc / room1.pi < prev    next >
Text File  |  1994-12-31  |  3KB  |  105 lines

  1. // Test of an environment map to simulate shadowing and reflectivity in a
  2. // scan converted image.  We will be generating a depth map for a light source,
  3. // the six faces of an environment map that wrap around a sphere, followed by
  4. // a render of the final image.  The last frame generated by this file will be
  5. // the scene contained in the file room2.inc, plus a sphere reflecting the
  6. // objects in that file.
  7. //
  8. // Polyray input file: Alexander Enzmann
  9.  
  10. // Generate eight frames, the first generates a depth map for doing shadowing
  11. // of the light source.  The next six generate one image for each direction of
  12. // the environment map around the reflective sphere.  The final frame is the
  13. // full image, including shadowing and reflectivity.
  14. start_frame 0
  15. end_frame 7
  16.  
  17. // This is where the reflective sphere will be (this definition must come
  18. // before the file rsphere.inc in read).
  19. define sphere_location <0, 0, 0>
  20.  
  21. // These two arrays are used to generate orientations for an environment map
  22. define at_vecs [<1, 0, 0>, <-1, 0, 0>, < 0, 1, 0>, < 0,-1, 0>, < 0, 0, 1>,
  23.                 < 0, 0,-1>]
  24. define up_vecs [< 0, 1, 0>, < 0, 1, 0>, < 0, 0, 1>, < 0, 0,-1>, < 0, 1, 0>,
  25.                 < 0, 1, 0>]
  26.  
  27. // Define the characteristics of the light.
  28. define light_location <-10, 30, -2>
  29. define light_at <0, 0, 0>
  30. define light_up <0, 1, 0>
  31. define light_angle 45
  32. define light_aspect 4/3
  33. if (frame > 0)
  34.    // We only use the light after it's depth map has been generated
  35.    depthmapped_light {
  36.       color white
  37.       depth "out000.tga"
  38.       from light_location
  39.       at light_at
  40.       up light_up
  41.       angle light_angle
  42.       aspect light_aspect
  43.       hither 0.3
  44.       }
  45.  
  46. // Grab the standard set of colors and set the background color
  47. include "..\colors.inc"
  48. background Midnight_Blue
  49.  
  50. // Base the orientation of the camera on the frame number.  The first six
  51. // frames are used to generate the environment map, the final frame is
  52. // used to generate the actual image.
  53. if (frame == 0) {
  54.    // Generate depth information for the light source
  55.    define from_vec light_location
  56.    define at_vec light_at
  57.    define up_vec light_up
  58.    define x_res 480
  59.    define y_res 360
  60.    define view_angle light_angle
  61.    define image_aspect light_aspect
  62.    define view_form 1
  63.    }
  64. else if (frame < 7) {
  65.    // Generate the images for the environment map
  66.    define from_vec sphere_location
  67.    define at_vec sphere_location + at_vecs[frame-1]
  68.    define up_vec up_vecs[frame-1]
  69.    define x_res 64
  70.    define y_res 64
  71.    define view_angle 90
  72.    define image_aspect 1
  73.    define view_form 0
  74.    }
  75. else {
  76.    // At last we are generating the full image.  Pull in the environment
  77.    // mapped sphere and define the viewpoint for the image.
  78.    // define from_vec rotate(<0, 6, -8>, <0, -60, 0>)
  79.    define from_vec <0, 6, -8>
  80.    define at_vec <0, 0, 0>
  81.    define up_vec <0, 1, 0>
  82.    define x_res 256
  83.    define y_res 256
  84.    define view_angle 60
  85.    define image_aspect 1
  86.    define view_form 0
  87.    }
  88.  
  89. // The viewpoint will change based on what we are rendering.
  90. viewpoint {
  91.    from from_vec
  92.    at at_vec
  93.    up up_vec
  94.    angle view_angle
  95.    resolution x_res, y_res
  96.    aspect image_aspect
  97.    image_format view_form
  98.    }
  99.  
  100. // Read in the scene definition
  101. include "room2.inc"
  102.  
  103. // Read in the object that we are building the environment map for.
  104. include "rsphere.inc"
  105.