5.5 CAMERA
------------

Every scene in POV-Ray has a camera defined.  If you do not specify a 
camera then a default camera is used.  The camera definition describes the 
position, angle and properties of the camera viewing the scene. POV-Ray 
uses this definition to do a simulation of the camera in the ray tracing 
universe and "take a picture" of your scene.

The camera simulated in POV-Ray is a pinhole camera. Pinhole cameras have a 
fixed focus so all elements of the scene will always be perfectly in focus. 
The pinhole camera is not able to do soft focus or depth of field effects.

A total of 6 vectors may be specified to define the camera but only a few 
of those are needed to in most cases.  Here is an introduction to simple 
camera placement.

5.5.1 LOCATION AND LOOK_AT

Under many circumstances just two vectors in the camera statement are all 
you need: location and look_at.  For example:

      camera {
        location <3,5,-10>
        look_at  <0,2,1>
      }

The location is simply the X, Y, Z coordinates of the camera. The camera 
can be located anywhere in the ray tracing universe.  The default location 
is <0,0,0>.  The look_at vector tells POV-Ray to pan and tilt the camera 
until it is looking at the specified X, Y, Z coordinate.  By default the 
camera looks at a point one unit in the +Z direction from the location. 

The look_at specification should almost always be the LAST item in the 
camera statement.  If other camera items are placed after the look_at 
vector then the camera may not continue to look at the specified point.

5.5.2 THE SKY VECTOR

Normally POV-Ray pans left or right by rotating about the Y axis until it 
lines up with the look_at point and then tilts straight up or down until 
the point is met exactly.  However you may want to slant the camera 
sideways like an airplane making a banked turn.  You may change the tilt of 
the camera using the "sky" vector.  For example:

      camera {
        location <3,5,-10>
        sky      <1,1,0>
        look_at  <0,2,1>
      }

This tells POV-Ray to roll the camera until the top of the camera is in 
line with the sky vector.  Imagine that the sky vector is an antenna 
pointing out of the top of the camera.  Then it uses the "sky" vector as 
the axis of rotation left or right and then to tilt up or down in line with 
the "sky" vector.  In effect you're telling POV-Ray to assume that the sky 
isn't straight up.  Note that the sky vector must appear before the look_at 
vector.  The sky vector does nothing on its own.  It only modifies the way 
the look_at vector turns the camera.  The default value for sky is <0,1,0>.

5.5.3 THE DIRECTION VECTOR

The "direction" vector serves two purposes.  It tells POV-Ray the initial 
direction to point the camera before moving it with look_at or rotate 
vectors.  It also controls the field of view.  

Note that this is only the initial direction.  Normally, you will use the 
look_at keyword, not the direction vector to point the camera in its actual 
direction. 

The length of the direction vector tells POV-Ray to use a telephoto or 
wide-angle view.  It is the distance from the camera location to the 
imaginary "view window" that you are looking through.  A short direction 
vector gives a wide angle view while a long direction gives a narrow, 
telephoto view.  

This figure illustrates the effect:

                 |\                                            |\   
                 | \                                           | \  
                 |  \                                          |  \ 
                 |   \                                         |   \
  Location       |   |            Location                     |   |
      *------------> |                *--------------------------> |
        Direction|   |                                         |   |
                 |   |                                         |   |
                 |   |                                         |   |
                  \  |                                          \  |
                   \ |                                           \ |
                    \|                                            \|


Short direction gives wide view...        long direction narrows view.

The default value is "direction <0,0,1>".

Be careful with short direction vector lengths like 1.0 and less. You may 
experience distortion on the edges of your images. Objects will appear to 
be shaped strangely. If this happens, move the location back and make the 
direction vector longer.

Wide angle example:
      camera {
        location  <3,5,-10>
        direction <0,0,1>
        look_at   <0,2,1>
      }

Zoomed in telephoto example:
      camera {
        location <3,5,-10>
        direction <0,0,8>
        look_at  <0,2,1>
      }

5.5.4 UP AND RIGHT VECTORS

The "up" vector defines the height of the view window.  The "right" vector 
defines the width of the view window.  This figure illustrates the 
relationship of these vectors:

      --------------------------
     |             ^            |
     |   up <0,1,0>|            |
     |             |            |
     |             |            |
     |             |            |
     |             |            |
     |             |            |
     |------------------------->|
     |   right<1.33,0,0>        |
     |             |            |
     |             |            |
     |             |            |
     |             |            |
     |             |            |
     |             |            |
      --------------------------

5.5.4.1 Aspect Ratio

Together these vectors define the "aspect ratio" (height to width ratio) of 
the resulting image.  The default values "up <0,1,0>" and "right 
<1.33,0,0>" results in an aspect ratio of about 4 to 3.  This is the aspect 
ratio of a typical computer monitor.  If you wanted a tall skinny image or 
a short wide panoramic image or a perfectly square image then you should 
adjust the up and right vectors to the appropriate proportions.

Most computer video modes and graphics printers use perfectly square 
pixels.  For example Macintosh displays and IBM S-VGA modes 640x480, 
800x600 and 1024x768 all use square pixels.  When your intended viewing 
method uses square pixels then the width and height you set with the +W and 
+H switches should also have the same ratio as the right and up vectors.  
Note that 640/480=4/3 so the ratio is proper for this square pixel mode.

Not all display modes use square pixels however.  For example IBM VGA mode 
320x200 and Amiga 320x400 modes do not use square pixels.  These two modes 
still produce a 4/3 aspect ratio image.  Therefore images intended to be 
viewed on such hardware should still use 4/3 ratio on their up & right 
vectors but the +W and +H settings will not be 4/3.

For example:
      camera {
        location <3,5,-10>
        up       <0,1,0>
        right    <1,0,0>
        look_at  <0,2,1>
      }

This specifies a perfectly square image.  On a square pixel display like 
SVGA you would use +W and +H settings such as +W480 +H480 or +W600 +H600.  
However on the non-square pixel Amiga 320x400 mode you would want to use 
values of +W240 +H400 to render a square image.

5.5.4.2 Handedness

The "right" vector also describes the direction to the right of the camera. 
It tells POV-Ray where the right side of your screen is.  The sign of the 
right vector also determines the "handedness" of the coordinate system in 
use. The default right statement is:

      right <1.33, 0, 0>

This means that the +X direction is to the right.  It is called a "left-
handed" system because you can use your left hand to keep track of the 
axes.  Hold out your left hand with your palm facing to your right.  Stick 
your thumb up.  Point straight ahead with your index finger. Point your 
other fingers to the right.  Your bent fingers are pointing to the +X 
direction.  Your thumb now points +Y.  Your index finger points +Z.

To use a right-handed coordinate system, as is popular in some CAD programs 
and other ray tracers, make the same shape using your right hand.  Your 
thumb still points up in the +Y direction and your index finger still 
points forward in the +Z direction but your other fingers now say the +X is 
to the left.  That means that the "right" side of your screen is now in the 
-X direction. To tell POV-Ray to compensate for this you should use a 
negative X value in the "right" vector like this:

      right <-1.33, 0, 0>

Some CAD systems, like AutoCAD, also have the assumption that the Z axis is 
the "elevation" and is the "up" direction instead of the Y axis. If this is 
the case you will want to change your "up" and "direction" as well.  Note 
that the up, right, and direction vectors must always remain perpendicular 
to each other or the image will be distorted.

5.5.5 TRANSFORMING THE CAMERA

The "translate" and "rotate" commands can re-position the camera once 
you've defined it.

For example:
      camera {
        location  < 0,  0,  0>
        direction < 0,  0,  1>
        up        < 0,  1,  0>
        right     < 1,  0,  0>
        rotate    <30, 60, 30>
        translate < 5,  3,  4>
      }                   
                      
In this example, the camera is created, then rotated by 30 degrees about 
the X axis, 60 degrees about the Y axis, and 30 degrees about the Z axis, 
then translated to another point in space.

5.5.6 CAMERA IDENTIFIERS

You may declare several camera identifiers if you wish.  This makes it easy 
to quickly change cameras.  For example:

      #declare Long_Lens=
            camera {
              location -z*100
              direction z*50
            }
      #declare Short_Lens=
            camera {
              location -z*50
              direction z*10
            }

      camera {
        Long_Lens    //edit this line to change lenses
        look_at Here
      }