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

  1.     So far, we've just used the sphere shape.  There are many other types of
  2.  shapes that can be rendered by POV-Ray.  First let's make some room in the
  3.  image by changing the sphere from a radius of 2 to a radius of 1 like this:
  4.        sphere {
  5.           <0, 1, 2>, 1
  6.           texture { ...  and so on.
  7.  
  8.  
  9.  Plane Object:
  10.  
  11.     Let's try out a computer graphics standard: The Checkered Floor.  Add the
  12.  following object to your .pov file:
  13.        plane {
  14.           <0, 1, 0>, 0
  15.           pigment {
  16.              checker
  17.              color Red
  18.              color Blue
  19.           }
  20.        }
  21.  
  22.     The object defined here is an infinite plane.  The vector <0, 1, 0> is
  23.  the surface normal of the plane (i.e., if you were standing on the surface,
  24.  the normal points straight up.) The number afterward is the distance that
  25.  the plane is displaced along the normal from the origin; in this case, the
  26.  floor is placed at Y=0 so that the sphere at Y=1, radius=1, is resting on
  27.  it.
  28.  
  29.     NOTE: There is no 'texture {...}' statement.  There really is an implied
  30.  texture there.  You might find that continually typing statements that are
  31.  nested like 'texture {pigment {...}}' can get to be a tiresome so POV-Ray
  32.  lets you leave out the 'texture {...}' under many circumstances.  In general
  33.  you only need the texture block surrounding a texture identifier (like the
  34.  PinkAlabaster example above), or when creating layered textures (which are
  35.  covered later).
  36.  
  37.     This pigment uses the checker color pattern and specifies that the two
  38.  colors red and blue should be used.
  39.  
  40.     Because the vectors <1,0,0>, <0,1,0> and <0,0,1> are used frequently,
  41.  POV-Ray has 3 built-in vector identifiers 'x', 'y', and 'z' respectively
  42.  that can be used as shorthand.  Thus the plane could be defined as:
  43.        plane {
  44.           y, 0
  45.           pigment {...  etc.
  46.  
  47.     NOTE: You do not use angle brackets around vector identifiers.
  48.  
  49.     Looking at the floor, you'll notice that the ball casts a shadow on the
  50.  floor.  Shadows are calculated very accurately by the ray tracer and creates
  51.  precise, sharp shadows.  In the real world, penumbral or 'soft' shadows are
  52.  often seen.  Later you'll learn how to use extended light sources to soften
  53.  the shadows.
  54.  
  55.  
  56.  Box Object:
  57.  
  58.     There are several other simple shapes available in POV-Ray.  The most
  59.  common are the box, cylinder and cone.  Try these examples in place of the
  60.  sphere:
  61.        box {
  62.           <-1, 0, -1>,        // Near lower left corner
  63.           <1, 0.5, 3>         // Far upper right corner
  64.           pigment {
  65.              DMFWood4       // Predefined from textures.inc 
  66.              scale 4         // Scale by same amount in all directions
  67.           }
  68.           rotate y*20         // Equivalent to 'rotate <0,20,0>'
  69.        }
  70.  
  71.     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 ob-jects can only be defined parallel to the axes.  You can later rotate them to any angle.
  72.  
  73.     NOTE: 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>'.
  74.  
  75.  
  76.  Cone Object:
  77.  
  78.     Here's another example:
  79.        cone {
  80.           <0, 1, 0>, 0.3         // Center and radius of one end
  81.           <1, 2, 3>, 1.0         // Center and radius of other end
  82.           pigment { DMFWood4 scale 4 }
  83.           finish { Shiny }
  84.        }
  85.  
  86.     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:
  87.        cone {
  88.           <0, 1, 0>, 0.3         // Center and radius of one end
  89.           <1, 2, 3>, 1.0         // Center and radius of other end
  90.           open                // Removes end caps
  91.           pigment { DMFWood4 scale 4 }
  92.           finish { Shiny }
  93.        }
  94.  
  95.  
  96.  Cylinder Object:
  97.  
  98.     You may also define a cylinder like this:
  99.        cylinder {
  100.           <0, 1, 0>,         // Center of one end
  101.           <1, 2, 3>,         // Center of other end
  102.           0.5               // Radius
  103.           open            // Remove end caps
  104.           pigment { DMFWood4 scale 4 }
  105.           finish { Shiny }
  106.        }
  107.  
  108.     Finally the standard include file 'shapes.inc' contains some predefined
  109.  shapes that are about the size of a sphere with a radius of one unit.  You
  110.  can invoke them like this:
  111.        object {
  112.           UnitBox
  113.           pigment { DMFWood4 scale 4 }
  114.           finish { Shiny }
  115.           scale 0.75
  116.           rotate <-20, 25, 0>
  117.           translate y
  118.        }
  119.  
  120.     That's the end of our brief tutorial.  We've only scratched the surface.
  121.  The rest of this document provides a reference to all of POV-Ray's features.
  122.