home *** CD-ROM | disk | FTP | other *** search
/ Mega A/V / mega_av.zip / mega_av / GRAPHUTL / POVSCN.ZIP / LEVEL3.ZIP / PENCIL.ZIP / PENCIL.POV < prev   
Text File  |  1992-07-03  |  8KB  |  274 lines

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