home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 2555 / povhlp / imagetut.hlp < prev    next >
Encoding:
Text File  |  1994-07-04  |  6.9 KB  |  159 lines

  1.     Let's create the scene file for a simple picture.  Since ray tracers thri-
  2.  ve on spheres, that's what we'll render first.
  3.  
  4.  
  5.  The Coordinate System:
  6.  
  7.     First, we have to tell POV-Ray where our camera is and where it's look-
  8.  ing.  To do this, we use 3D coordinates.  The usual coordinate system for
  9.  POV-Ray has the positive Y axis pointing up, the positive X axis pointing to
  10.  the right, and the positive Z axis pointing into the screen as follows:
  11.                +Y
  12.                |   +Z
  13.                |  /
  14.                | /
  15.                |/
  16.                |-------- +X
  17.  
  18.     The negative values of the axes point the other direction, as follows:
  19.                  +Y
  20.                  |   +Z
  21.                  |  /
  22.                  | /
  23.                  |/
  24.        -X -------|-------- +X
  25.                 /|
  26.                / |
  27.               /  |
  28.              -Z  |
  29.                  -Y
  30.  
  31.  
  32.  Adding Standard Include Files:
  33.  
  34.     Using your personal favorite text editor, create a file called 'picture1
  35.  .pov'.  Now, type in the following (NOTE: The input is case sensitive, so be
  36.  sure to get capital and lowercase letters correct):
  37.        #include 'colors.inc'      // The include files contain
  38.        #include 'shapes.inc'      // predefined scene elements
  39.        #include 'textures.inc'
  40.        camera {
  41.           location <0, 2, -3>
  42.           look_at  <0, 1,  2>
  43.        }
  44.  
  45.     The first include statement reads in definitions for various useful co-
  46.  lors.  The second and third include statements read in some useful shapes
  47.  and textures respectively.  When you get a chance, have a look through them
  48.  to see but a few of the many possible shapes and textures available.
  49.  
  50.     You may have as many include files as needed in a scene file.  Include
  51.  files may themselves contain include files, but you are limited to declaring
  52.  includes nested only 10 'deep'.
  53.  
  54.     Filenames specified in the include statements will be searched for in the
  55.  home (current) directory first, and if not found, will then be searched for
  56.  in directories specified by any '+L' (library path) options active.  This
  57.  would facilitate keeping all your 'include' (.inc) files such as shapes.inc,
  58.  colors.inc, and textures.inc in an 'include' subdirectory, and giving an
  59.  '+L' option on the command line to where your library of include files are.
  60.  
  61.  
  62.  Placing the Camera:
  63.  
  64.     The camera declaration describes where and how the camera sees the scene.
  65.  It gives X, Y, Z coordinates to indicate the position of the camera and what
  66.  part of the scene it is pointing at.  You describe X, Y, Z coordinates using
  67.  a 3-part 'vector'.  A vector is specified by putting 3 numeric values bet-
  68.  ween a pair of angle brackets and separating the values with commas.
  69.  
  70.     Briefly, 'location <0, 2, -3>' places the camera up two units and back
  71.  three units from the center of the ray tracing universe which is at <0,0,0>.
  72.  Remember that by default +Z is into the screen and -Z is back out of the
  73.  screen.
  74.  
  75.     Also 'look_at <0, 1, 2>' rotates the camera to point at X, Y, Z coordina-
  76.  tes <0, 1, 2>.  A point 5 units in front of and 1 unit lower than the came-
  77.  ra.  The look_at point should be the center of attention of your image.
  78.  
  79.  
  80.  Describing an Object:
  81.  
  82.     Now that the camera is set up to record the scene, let's place a red
  83.  sphere into the scene.  Type the following into your scene file:
  84.        sphere {
  85.           <0, 1, 2>, 2
  86.           texture {
  87.              pigment { color Yellow }   // Yellow is predefined in
  88.           }                             // COLORS.INC
  89.        }
  90.  
  91.     The first vector specifies center of the sphere.  In this example the X
  92.  coordinate is zero so it is centered left and right.  It is also at Y=1 or 1
  93.  unit up from the origin.  The Z coordinate is 2 which is 5 units in front of
  94.  the camera at Z=-3.  After the center vector is a comma followed by the ra-
  95.  dius which in this case is 2 units.  Since the radius is 1/2 the width of a
  96.  sphere, the sphere is 4 units wide.
  97.  
  98.  
  99.  Adding Texture to an Object:
  100.  
  101.     Now that we've defined the location and size of the sphere, we need to
  102.  describe the appearance of the surface.  The texture {...} block specifies
  103.  these parameters.  Texture blocks describe the color, bumpiness and finish
  104.  properties of an object.  In this example we will specify the color only.
  105.  This is the minimum we must do.  All other texture options except color will
  106.  use the default values.
  107.  
  108.     The color you define is the way you want it to look if fully illuminated.
  109.  If you were painting a picture of a sphere you would use dark shades of a
  110.  color to indicate the shadowed side and bright shades on the illuminated
  111.  side.  However ray tracing takes care of that for you.  You pick the basic
  112.  color inherent in the object and POV-Ray brightens or darkens it depending
  113.  on the lighting in the scene.  Because we are defining the basic color the
  114.  object actually is, rather than how it looks, the parameter is called 'pig-
  115.  ment'.
  116.  
  117.     Many types of color patterns are available for use in a pigment {...}
  118.  statement.  The keyword 'color' specifies that the whole object is to be one
  119.  solid color rather than some pattern of colors.  The word 'Yellow' is a co-
  120.  lor identifier which was previously defined in the standard include file
  121.  'colors.inc'.
  122.  
  123.     If no standard color is available for your needs, you may define your own
  124.  color by using the color keyword followed by 'red', 'green' and 'blue' key-
  125.  words specifying the amount of red, green and blue to be mixed.  For example
  126.  a nice shade of pink can be specified by:
  127.        color red 1.0 green 0.8 blue 0.8
  128.  
  129.     The values after each keyword should be in the range 0.0 to 1.0.  Any of
  130.  the three components not specified will default to 0.  A shortcut notation
  131.  may also be used.  The following produces the same shade of pink:
  132.        color rgb <1.0, 0.8, 0.8>
  133.  
  134.     Colors are explained in more detail later.
  135.  
  136.  
  137.  Defining a Light Source:
  138.  
  139.     One more detail is needed for our scene.  We need a light source.  Until
  140.  you create one, there is no light in this virtual world.  Add the following
  141.  text to your scene file:
  142.        light_source { <2, 4, -3> color White }
  143.  
  144.     The vector specifies the location of the light as 2 units to our right, 4
  145.  units above the origin and 3 units back from the origin.  The light_source
  146.  is invisible, it only casts light, so no texture is needed.
  147.  
  148.     That's it!  Close the file and render a small picture of it using this
  149.  command:
  150.        POVRAY +W160 +H120 +P +X +D0 -V -Ipicture1.pov
  151.  
  152.     If your computer does not use the command line, see the executable docs
  153.  for the correct command to render a scene.
  154.  
  155.     You may set any other command line options you like, also.  The scene is
  156.  output to the image file DATA.TGA (or some suffix other than TGA if your
  157.  computer uses a different file format).  You can convert DATA.TGA to a GIF
  158.  image using the commands listed in the docs included with your executable.
  159.