home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / MISC / PVDAT.ZIP / PENCIL.DAT < prev    next >
Encoding:
Text File  |  1991-09-07  |  7.4 KB  |  284 lines

  1. // Persistence of Vision Raytracer
  2. // Sample file
  3. // By Jorge Arreguin
  4. {
  5.   This data file makes a pencil along y axis with the label "DKBtrace 2.11"
  6.  
  7.   By:  Jorge Arreguin
  8.  
  9.   Translation to English and dkb version 2.10 by Aaron a. Collins with a bit
  10.   of help from David on the imagemap registration.
  11.  
  12.   note - unless this is rendered at a minimum of 640 x whatever, the dkb logo
  13.          is quite unreadable.
  14.  
  15.   The Pencil - major export of Faber, Pennsylvania, due to the plentiful
  16.   presence of pencilwood trees and eraser-root plants, and the nearby
  17.   graphite mines.
  18.                                                 (John Landis - Animal House)
  19. }
  20.  
  21. #include "shapes.dat"
  22. #include "colors.dat"
  23. #include "textures.dat"
  24.  
  25. #declare PencilPaint =
  26. texture
  27.    color red 1.0 green 0.6666 blue 0.33333
  28. end_texture
  29.  
  30. view_point
  31.   location <0.0 -70.0 0.0>
  32.   direction <0.0 2.5 0.0>
  33.   up <0.0 0.0 1.0>
  34.   right <1.333333 0.0 0.0>
  35.   rotate < -20.0 0.0 -140.0 >
  36.   translate < 0.0 0.0 2.0 >
  37. end_view_point
  38.  
  39. object
  40.   sphere <0.0 0.0 0.0> 2.0 end_sphere
  41.   translate <30.0 30.0 55.0>
  42.   texture
  43.     colour White
  44.     ambient 1.0
  45.     diffuse 0.0
  46.   end_texture
  47.   light_source
  48.   colour White
  49. end_object
  50.  
  51. object
  52.   sphere <0.0 0.0 0.0> 3.0 end_sphere
  53.   translate <-40.0 -40.0 35.0>
  54.   texture
  55.     colour Grey
  56.     ambient 1.0
  57.     diffuse 0.0
  58.   end_texture
  59.   light_source
  60.   colour Grey
  61. end_object
  62.  
  63.  
  64. composite
  65.  
  66. {----------------------------- parte metalica ----------------------}
  67. {                             (that metal part)                     }
  68. composite
  69. object
  70.   union
  71.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 2.0 > end_quadric
  72.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 1.0 > end_quadric
  73.     quadric QSphere scale < 4.0 4.0 1.5 > end_quadric
  74.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 -1.0 > end_quadric
  75.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 -2.0 > end_quadric
  76.   end_union
  77.   translate < 0.0 0.0 38.5 >
  78.   texture
  79.     color Gold
  80.     reflection 0.3
  81.   end_texture
  82. end_object
  83.  
  84. object
  85.   union
  86.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 2.0 > end_quadric
  87.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 1.0 > end_quadric
  88.     quadric QSphere scale < 4.0 4.0 1.5 > end_quadric
  89.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 -1.0 > end_quadric
  90.     quadric QSphere scale < 4.0 4.0 1.5 > translate <0.0 0.0 -2.0 > end_quadric
  91.   end_union
  92.   translate < 0.0 0.0 30.5 >
  93.   texture
  94.     color Gold
  95.     reflection 0.3
  96.   end_texture
  97. end_object
  98.  
  99. object
  100.   intersection Z_Disk end_intersection
  101.   scale < 3.5 3.5 3.0 >
  102.   translate < 0.0 0.0 34.0 >
  103.   texture
  104.     color Brown
  105.     reflection 0.25
  106.   end_texture
  107. end_object
  108.  
  109. bounded_by
  110.   sphere <0.0 0.0 34.0> 9.0 end_sphere
  111. end_bound
  112. end_composite
  113.  
  114. {---------------------------------- borrador ----------------------------}
  115. {                (the rubber eraser, from eraser-root plants)            }
  116.  
  117. composite
  118.  object
  119.    intersection Z_Disk end_intersection
  120.    scale < 3.5 3.5 3.0 >
  121.    translate < 0.0 0.0 41.0 >
  122.    texture
  123.     color Pink
  124.    end_texture
  125.  end_object
  126.  object sphere < 0.0 0.0 44.0 > 3.5 end_sphere
  127.    texture
  128.     color Pink
  129.    end_texture
  130.  end_object
  131. end_composite
  132.  
  133. {---------------------------------- cuerpo de madera ---------------------}
  134. {                                 (body of pencilwood)                    }
  135. object
  136.   difference
  137.    intersection
  138.     plane < 0.0 1.0 0.0 > 3.031
  139.       texture PencilPaint end_texture
  140.         texture
  141.         imagemap <-1.0 0.0 1.0> gif "pvray05.gif" 
  142.         alpha 0 1.0      { colour 0 is the "key" or transparent colour }
  143.         once
  144.         end_map
  145.         scale <15.0 1.0 15.0>
  146.         translate <-12.2 0.0 12.0 >
  147.       end_texture
  148. { Now for the complicated image mapping:
  149.   Currently, the pencil is standing up in the z axis:
  150.                    z
  151.  
  152.              eraser  ^ *vp
  153.                      | |   
  154.                      | |
  155.                      | |----/ y
  156.                      |     /
  157.                      |    /
  158.                      |   /
  159.                      |  /
  160.                      | /
  161.              point   |/
  162.                      -------------->
  163.                                    x
  164.  
  165.   We want the image to be mapped as follows (viewed from the +ve y axis):
  166.  
  167.           Right
  168.           ---- z=28.0
  169.           |  |
  170.           |..|
  171.           |..|
  172.           |..|
  173.           |ee|
  174.           |ce|
  175.       Top |ar| Bottom
  176.           |rf|
  177.           |t |
  178.           | s|
  179.           |b'|
  180.           |Kt|
  181.           |di|
  182.           ---- z=12.7
  183.           Left
  184.  
  185.           ^  ^
  186.           |  |
  187.     x=1.75   x=-1.75
  188.  
  189.  The image map above gives (viewed from the y axis):
  190.  
  191.                    ^ z
  192.           1,1 Right|
  193.              ------|
  194.              |     |
  195.              |     |
  196.          Top |     |Bottom
  197.              |     |
  198.              |     |
  199.          <----------
  200.           x   Left     
  201.  
  202.   Which is at least in the right orientation.
  203.  
  204.   Now, we must scale the image so the letters are the right size. }
  205.  
  206. //         scale <15.0 1.0 15.0>  { Never use 0 for any scale value }
  207.  
  208. { Now, we align the top left of the picture to the proper point on the
  209.   pencil.  This is a bit tricky because the top left of the picture is now
  210.   at x=15 z=0.  We have to move it to about x=-12, z=12 because the letters
  211.   don't start at the very top of the image. }
  212.  
  213. //         translate <-12.20 0 12>
  214.  
  215. { As you may have guessed, this still took a lot of trial and error to get it
  216.   right, but some analysis of the picture before hand saved a lot of time. }
  217. //      end_texture
  218.     end_plane
  219.     plane < 0.0 1.0 0.0 > 3.031
  220.       rotate < 0.0 0.0 60.0 >
  221.       texture PencilPaint end_texture
  222.     end_plane
  223.     plane < 0.0 1.0 0.0 > 3.031
  224.       rotate < 0.0 0.0 120.0 >
  225.       texture PencilPaint end_texture
  226.     end_plane
  227.     plane < 0.0 1.0 0.0 > 3.031
  228.       rotate < 0.0 0.0 180.0 >
  229.       texture PencilPaint end_texture
  230.     end_plane
  231.     plane < 0.0 1.0 0.0 > 3.031
  232.       rotate < 0.0 0.0 240.0 >
  233.       texture PencilPaint end_texture
  234.     end_plane
  235.     plane < 0.0 1.0 0.0 > 3.031
  236.       rotate < 0.0 0.0 300.0 >
  237.       texture PencilPaint end_texture
  238.     end_plane
  239.     plane < 0.0 0.0 1.0 > 28.0 end_plane
  240.     plane < 0.0 0.0 1.0 > 3.629 inverse end_plane
  241.    end_intersection
  242.    quadric Cone_Z inverse scale < 0.275558 0.275558 1.0 > end_quadric
  243.   end_difference
  244.   texture
  245.     Pine_Wood
  246.     turbulence 0.1
  247.     scale <1.5 1.5 1.5>
  248.     rotate <0.0 90.0 0.0>
  249.     translate <30.0 0.0 0.0>
  250.   end_texture
  251. end_object
  252.  
  253. {---------------------------- punta de grafito ------------------------------}
  254. {                            (point of graphite)                             }
  255.  
  256. object
  257.   intersection
  258.     quadric Cone_Z scale < 0.275558 0.275558 1.0 > end_quadric
  259.     plane < 0.0 0.0 1.0 > 3.629 end_plane
  260.     plane < 0.0 0.0 1.0 > 0.001 inverse end_plane
  261.   end_intersection
  262.   texture
  263.     color Black
  264.     reflection 0.25
  265.     phong 1.0
  266.     phongsize 20
  267.   end_texture
  268. end_object
  269.  
  270. rotate < 90.0 0.0 0.0 >
  271. translate < 0.0 22.0 3.5 >
  272. end_composite
  273.  
  274. {-------------------------- plano de horizonte --------------------------}
  275. {                           (plane of horizon)                           }
  276.  
  277. object
  278.   plane < 0.0 0.0 1.0 > 0.0 end_plane
  279.   texture
  280.     color CGreen
  281.     reflection 0.25
  282.   end_texture
  283. end_object
  284.