home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 279 / POVSCN20.ZIP / PENCIL.POV < prev    next >
Text File  |  1993-09-28  |  8KB  |  273 lines

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