A POV Introduction

A modeling system is a program that allows you to construct virtual objects (objects that don't exist physically), and then take pictures of them. POV is a modeling system for 3D objects. You will find POV in the launch pad on your screen. If you're sitting on a Macintosh in the lab, you will find the documentation for POV here. In this document, I give you some short example programs that show you some of the possiblities of POV.

To start POV, click on the POV-Ray launch button. It will start up with a "model" window labeled Untitled.POV. During this document, you should select text from your browser and paste it into the model window. As a little test, here's your first POV program.


Do this:
  1. Take your mouse, and scan over the text below, go to the Edit menu and select Copy:
    
    #include "colors.inc"
    
    camera
    {
      location  <0,0,-10>
      look_at   <0,0,0>
    }
    
    light_source
    {
        <-10,10,0>
    	color White
    }
    
    background { color Cyan }
    
    sphere
    {
    	<0,0,0>, 1 
    	texture {pigment { color Red } finish{specular 1}}
    }
    
  2. Now, go to the model window in POV, and select Paste from it's Edit menu. (If there's any text in the window, it should be deleted first.)
  3. Save the file on the Desktop.
  4. Pull down the Render menu to "Start Rendering". This creates an image:
    The program will automatically save a PICT file for you, right next to the POV file. You can use PhotoShop to convert this to whatever form you want (GIF, JPEG, etc.).

    So, what's going on? Let's break down the parts of the model. This file, like every POV file, has at least one "camera" and one "light_source". You need a camera to take pictures with, and a light_source to shine on any objects you might be observing.

    Every point in space is labeled with three numbers: x, y, and z. The coordinate system we use will have x increasing to the right, y increasing upward, and z increasing into the screen:

    We can remember this orientation by sticking our LEFT thumb down the positive x axis and curling our fingers around in space. Our fingers curl from positive y to positive z. Here's a picture:
    The point at the intersection of the axes is <0,0,0>. The first point mentioned in the camera description is <0,0,-10>:
    camera
    {
      location  <0,0,-10>
      look_at   <0,0,0>
    }
    
    It says that the camera is located ten units in front of the screen. It's looking at the intersection of the axes, or the origin.

    The light is located up and to the left of the origin:

    light_source
    {
        <-10,10,0>
    	color White
    }
    
    It's sitting above the negative x axis. If you look at the picture, you can see the light shining on the ball to the left. That's above the negative x axis.

    Now, we make up the scene. The background (or sky) color is Cyan, a light blue:

    background { color Cyan }
    
    Cyan is a color name that POV knows about. It knows about a large number of colors, and you can specify your own.

    We place a single ball, or sphere, at the origin, it has a radius of 3:

    sphere
    {
    	<0,0,0>, 3
    	texture {pigment { color Red } finish{specular 1}}
    }
    
    The "texture" specifies the kind of paint you use on the ball. This paint is Red, and is very shiny.
    Do this: Change the number after the word "specular" to zero. It makes the paint "flat" or "not shiny". This is the image:
    Because we changed the finish to zero, the sphere does not reflect much light.
    Do this: To select a new for our sphere, we can pick a special color of our own:
    1. Change the background color command to the following:
      background { color red .5 green 0 blue .5 }
      
      This changes the image so that it has a purple background:
      You can think of colors as being made up from three different lights: one red, one green, and one blue. If you turn the red lights on half way, and the green light off (0), you get purple. You can pick your own colors by select combinations of red, green and blue. Make sure the values are between 0 and 1!
      Do this: Now, let's create a new picture. You can either start a new file, or delete the contents of the model window (select "Select All" from the "Edit" menu, and press delete.). Now, copy the following model file into the model window. It's long, but press the mouse at the top and drag downwards until the end. Then paste it in the model window.
      // Comments have two slashes beforehand
      #include "colors.inc"
      #include "textures.inc"
      background { color White }
      
      camera
      {
        location  <-10 , 0, -10>
        look_at   <0,0,0>
      }
      
      light_source
      {
        <-30,20,-20>
        color White
      }
      
      sphere { <0,0,0>, 1 
          texture {
              pigment { 
                  checker  // checkerboard pattern, made up of two pigments:
                  pigment { Jade } // a type of rock!
                  pigment { wood scale 0.2}  // wood, with grain
              } 
              finish{specular 1}
          }
          scale 6
      }
      
      This is a checkered sphere with two different types of pigment: a Jade like stone, and a wood color:
      Pretty cool.
      Do this: We can even map a picture onto the sphere. To be ideally, the picture should be twice as wide as it is tall. Here's an example, you can save as "heather.gif":
      We're going to map this image onto our sphere. To do this, we make the pigment an "image map":
      #include "colors.inc"
      
      background { color Cyan }
      
      camera
      {
          location  <0, 0, -10.0>
          look_at   <0,0,0>
      }
      
      light_source
      {
          <10,10,-10> 
          color White
      }
      light_source
      {
          <-10,10,-10> 
          color White
      }
      light_source
      {
          <1,-10,-10> 
          color White
      }
      
      sphere { <0,0,0>, 4
      	texture {
              pigment {
                  image_map { gif "heather.gif" map_type 1 }
              }
              finish{specular 0.5}
          }
      	rotate 0
      }
      
      Here's what Heather looks like, mapped to a sphere:
      If we change the value of the "rotate" command from 0 to 45, the sphere is rotated 45 degrees:
      If we change the value of the "rotate" command to 45*x, the sphere is rotated 45 degrees about the x axis:

      Do this:We now have one more simple image: some text. This is ideal for making up headings for home pages:
      #include "colors.inc"
      #include "textures.inc"
      
      camera
      {
        location  <0 , 0, -15>
        look_at   <0,0,0>
      }
      
      light_source
      {
        <-30,20,-20>
        color White
      }
      
      light_source
      {
        <30,20,-20>
        color White
      }
      
      // A background screen:
      plane { z, 20 
          pigment {color White}}
      
       
      text { ttf "timrom.ttf" "duane" 0.5, 0 // text is 0.5 units thick
          pigment { Jade }
      	translate <-1.25,0,-0.25> // move the text to the left, and backward
      	scale 5
      	rotate 0*z
      }
      
      This image has two lights shining on the word "duane" against a background screen. The screen is a sheet or a "plane" that is 20 units away on the z axis. The result is the following image:
      The text is set in "times roman", and the letters are 0.5 units thick. There are 0 units of extra space between the letters. The letters are made of Jade. Each letter is about 1 unit high, and .6 units wide. To center it about the origin, we have to translate it to the left and back toward us. Finally, we scale the word up by a factor of 5 to make it large enough to see.
      Do this: Change the rotate command so that it reads
      	rotate 45*z
      
      When you render the image, you get the following:
      Clearly, we can rotate the word any number of degrees between 0 and 360 and the word will spin about the axis.

      Experiment by using your own name. Take the PICT file and save it as a JPEG file in PhotoShop. You can then add it to your web page!


      Try this: This program is just like the last, except for the very last line. We change the rotate command so that it rotates around the z axis by an amount called "clock":
      #include "colors.inc"
      #include "textures.inc"
      
      camera
      {
        location  <0 , 0, -15>
        look_at   <0,0,0>
      }
      
      light_source
      {
        <-30,20,-20>
        color White
      }
      
      light_source
      {
        <30,20,-20>
        color White
      }
      
      // A background screen:
      plane { z, 20 
          pigment {color White}}
      
       
      text { ttf "timrom.ttf" "duane" 0.5, 0 // text is 0.5 units thick
          pigment { Jade }
      	translate <-1.25,0,-0.25> // move the text to the left, and backward
      	scale 5
      	rotate clock*z
      }
      
      If we make "clock" run from 0 to 360, the text spins about the axis, making an animation:
      Here's how to do it:
      1. Copy the text into the model window.
      2. Go to the Edit menu, and pull it down to Preferences, and then over to "File Rendering". You will see a display like this:
        If it does not say "Animation", select the "Animation" option.
      3. Click on "Turn on clock animation". This makes the "clock" variable drive the animation.
      4. Set the Initial clock value to 0 and the Final clock value to 360.
      5. Press Save.
      6. Pull the Render menu down to "Start Rendering". It will render 20 frames with values of clock between 0 and 360. This will cause the text to spin all the way around. Each of the frames will have a name like "Untitled0001". You can use these frames to build an animation from PICT files!
      Look at these animations, generated by POV: