home *** CD-ROM | disk | FTP | other *** search
- Let's create the scene file for a simple picture. Since ray tracers thri-
- ve on spheres, that's what we'll render first.
-
-
- The Coordinate System:
-
- First, we have to tell POV-Ray where our camera is and where it's look-
- ing. To do this, we use 3D coordinates. The usual coordinate system for
- POV-Ray has the positive Y axis pointing up, the positive X axis pointing to
- the right, and the positive Z axis pointing into the screen as follows:
- +Y
- | +Z
- | /
- | /
- |/
- |-------- +X
-
- The negative values of the axes point the other direction, as follows:
- +Y
- | +Z
- | /
- | /
- |/
- -X -------|-------- +X
- /|
- / |
- / |
- -Z |
- -Y
-
-
- Adding Standard Include Files:
-
- Using your personal favorite text editor, create a file called 'picture1
- .pov'. Now, type in the following (NOTE: The input is case sensitive, so be
- sure to get capital and lowercase letters correct):
- #include 'colors.inc' // The include files contain
- #include 'shapes.inc' // predefined scene elements
- #include 'textures.inc'
- camera {
- location <0, 2, -3>
- look_at <0, 1, 2>
- }
-
- The first include statement reads in definitions for various useful co-
- lors. The second and third include statements read in some useful shapes
- and textures respectively. When you get a chance, have a look through them
- to see but a few of the many possible shapes and textures available.
-
- You may have as many include files as needed in a scene file. Include
- files may themselves contain include files, but you are limited to declaring
- includes nested only 10 'deep'.
-
- Filenames specified in the include statements will be searched for in the
- home (current) directory first, and if not found, will then be searched for
- in directories specified by any '+L' (library path) options active. This
- would facilitate keeping all your 'include' (.inc) files such as shapes.inc,
- colors.inc, and textures.inc in an 'include' subdirectory, and giving an
- '+L' option on the command line to where your library of include files are.
-
-
- Placing the Camera:
-
- The camera declaration describes where and how the camera sees the scene.
- It gives X, Y, Z coordinates to indicate the position of the camera and what
- part of the scene it is pointing at. You describe X, Y, Z coordinates using
- a 3-part 'vector'. A vector is specified by putting 3 numeric values bet-
- ween a pair of angle brackets and separating the values with commas.
-
- Briefly, 'location <0, 2, -3>' places the camera up two units and back
- three units from the center of the ray tracing universe which is at <0,0,0>.
- Remember that by default +Z is into the screen and -Z is back out of the
- screen.
-
- Also 'look_at <0, 1, 2>' rotates the camera to point at X, Y, Z coordina-
- tes <0, 1, 2>. A point 5 units in front of and 1 unit lower than the came-
- ra. The look_at point should be the center of attention of your image.
-
-
- Describing an Object:
-
- Now that the camera is set up to record the scene, let's place a red
- sphere into the scene. Type the following into your scene file:
- sphere {
- <0, 1, 2>, 2
- texture {
- pigment { color Yellow } // Yellow is predefined in
- } // COLORS.INC
- }
-
- The first vector specifies center of the sphere. In this example the X
- coordinate is zero so it is centered left and right. It is also at Y=1 or 1
- unit up from the origin. The Z coordinate is 2 which is 5 units in front of
- the camera at Z=-3. After the center vector is a comma followed by the ra-
- dius which in this case is 2 units. Since the radius is 1/2 the width of a
- sphere, the sphere is 4 units wide.
-
-
- Adding Texture to an Object:
-
- Now that we've defined the location and size of the sphere, we need to
- describe the appearance of the surface. The texture {...} block specifies
- these parameters. Texture blocks describe the color, bumpiness and finish
- properties of an object. In this example we will specify the color only.
- This is the minimum we must do. All other texture options except color will
- use the default values.
-
- The color you define is the way you want it to look if fully illuminated.
- If you were painting a picture of a sphere you would use dark shades of a
- color to indicate the shadowed side and bright shades on the illuminated
- side. However ray tracing takes care of that for you. You pick the basic
- color inherent in the object and POV-Ray brightens or darkens it depending
- on the lighting in the scene. Because we are defining the basic color the
- object actually is, rather than how it looks, the parameter is called 'pig-
- ment'.
-
- Many types of color patterns are available for use in a pigment {...}
- statement. The keyword 'color' specifies that the whole object is to be one
- solid color rather than some pattern of colors. The word 'Yellow' is a co-
- lor identifier which was previously defined in the standard include file
- 'colors.inc'.
-
- If no standard color is available for your needs, you may define your own
- color by using the color keyword followed by 'red', 'green' and 'blue' key-
- words specifying the amount of red, green and blue to be mixed. For example
- a nice shade of pink can be specified by:
- color red 1.0 green 0.8 blue 0.8
-
- The values after each keyword should be in the range 0.0 to 1.0. Any of
- the three components not specified will default to 0. A shortcut notation
- may also be used. The following produces the same shade of pink:
- color rgb <1.0, 0.8, 0.8>
-
- Colors are explained in more detail later.
-
-
- Defining a Light Source:
-
- One more detail is needed for our scene. We need a light source. Until
- you create one, there is no light in this virtual world. Add the following
- text to your scene file:
- light_source { <2, 4, -3> color White }
-
- The vector specifies the location of the light as 2 units to our right, 4
- units above the origin and 3 units back from the origin. The light_source
- is invisible, it only casts light, so no texture is needed.
-
- That's it! Close the file and render a small picture of it using this
- command:
- POVRAY +W160 +H120 +P +X +D0 -V -Ipicture1.pov
-
- If your computer does not use the command line, see the executable docs
- for the correct command to render a scene.
-
- You may set any other command line options you like, also. The scene is
- output to the image file DATA.TGA (or some suffix other than TGA if your
- computer uses a different file format). You can convert DATA.TGA to a GIF
- image using the commands listed in the docs included with your executable.
-