4.3 More Shapes

So far, we've just used the sphere shape. There are many other types of shapes that can be rendered by POV-Ray. First let's make some room in the image by changing the sphere from a radius of 2 to a radius of 1 like this:
      sphere {
        <0, 1, 2>, 1 
        texture { ... and so on.

4.3.1 Plane Object

Let's try out a computer graphics standard - "The Checkered Floor." Add the following object to your .pov file:
      plane {
        <0, 1, 0>, 0 
        pigment {
          checker
            color Red
            color Blue
        }
      }
See the result.
The object defined here is an infinite plane. The vector <0, 1, 0> is the surface normal of the plane (i.e., if you were standing on the surface, the normal points straight up.) The number afterward is the distance that the plane is displaced along the normal from the origin - in this case, the floor is placed at Y=0 so that the sphere at Y=1, radius= 1, is resting on it. Notice that there is no "texture{...}" statement. There really is an implied texture there. You might find that continually typing statements that are nested like "texture {pigment {...}}" can get to be a tiresome so POV-Ray lets you leave out the "texture{...}" under many circumstances. In general you only need the texture block surrounding a texture identifier (like the PinkAlabaster example above), or when creating layered textures (which are covered later). This pigment uses the checker color pattern and specifies that the two colors red and blue should be used. Because the vectors <1,0,0>, <0,1,0> and <0,0,1> are used frequently, POV- Ray has 3 built-in vector identifiers "x", "y", and "z" respectively that can be used as shorthand. Thus the plane could be defined as:
      plane { 
        y,0 
        pigment {... etc.
Note that you do not use angle brackets around vector identifiers. Looking at the floor, you'll notice that the ball casts a shadow on the floor. Shadows are calculated very accurately by the ray tracer and creates precise, sharp shadows. In the real world, penumbral or "soft" shadows are often seen. Later you'll learn how to use extended light sources to soften the shadows.

4.3.2 Box Object

There are several other simple shapes available in POV-Ray. The most common are the box, cylinder and cone. Try these examples in place of the sphere:
      box {
        <-1,0  ,-1>,     // Near lower left corner
        < 1,0.5, 3>      // Far upper right corner
        pigment {
          DMFWood4      // Pre-defined from textures.inc 
          scale 4       // Scale by the same amount in all
                        // directions
        }
        rotate y*20     // Equivalent to "rotate <0,20,0>"
      }
In this example you can see that a box is defined by specifying the 3D coordinates of opposite corners. The first vector must be the minimum x,y,z coordinates and the 2nd vector must be the maximum x,y,z values. Box objects can only be defined parallel to the axes. You can later rotate them to any angle. Note that you can perform simple math on values and vectors. In the rotate parameter we multiplied the vector identifier "y" by 20. This is the same as "<0,1,0>*20" or "<0,20,0>".

4.3.3 Cone Object

Here's another example:
      cone {
        <0,1,0>,0.3    // Center and radius of one end
        <1,2,3>,1.0    // Center and radius of other end
        pigment {DMFWood4  scale 4 }
        finish {Shiny}  
      }
Click!
The cone shape is defined by the center and radius of each end. In this example one end is at location <0,1,0> and has radius of 0.3 while the other end is centered at <1,2,3> with radius 1. If you want the cone to come to a sharp point then use a 0 radius. The solid end caps are parallel to each other and perpendicular to the cone axis. If you want a hollow cone with no end caps then add the keyword "open" after the 2nd radius like this:
      cone {
        <0,1,0>,0.3    // Center and radius of one end
        <1,2,3>,1.0    // Center and radius of other end
        open           // Removes end caps
        pigment {DMFWood4  scale 4 }
        finish {Shiny}  
      }

Click!

4.3.4 CYLINDER OBJECT

You may also define a cylinder like this:
      cylinder {
        <0,1,0>,       // Center of one end
        <1,2,3>,       // Center of other end
        0.5            // Radius
        open           // Remove end caps
        pigment {DMFWood4  scale 4 }
        finish {Shiny}  
      }
Click!
Finally the standard include file "shapes.inc" contains some pre-defined shapes that are about the size of a sphere with a radius of one unit. You can invoke them like this:
      object {
        UnitBox
        pigment {DMFWood4  scale 4 }
        finish {Shiny}  
        scale 0.75
        rotate <-20,25,0>
        translate y
      }
Click!
That's the end of our brief tutorial. We've only scratched the surface. The rest of this document provides a reference to all of POV-Ray's features.

Jürgen Hüttner <huette@fu-berlin.de>

Note: this is the povray-tutorial of the Povray-Team. I just made the html-version and added the pictures. You can find the complete povray-documentation here. In that directory you will also find the rest of the povray-distribution.

Last modified: Tue Oct 8 12:30:24 1996