home *** CD-ROM | disk | FTP | other *** search
/ Inside Multimedia 1995 December / IMM1295.ISO / share / grafik / povhelp / bicubic.hlp < prev    next >
Text File  |  1994-07-04  |  5KB  |  87 lines

  1.     A bicubic patch is a 3D curved surface created from a mesh of triangles.
  2.  POV-Ray supports a type of bicubic patch called a Bezier patch.  A bicubic
  3.  patch is defined as follows:
  4.        bicubic_patch {
  5.           type PATCH_TYPE
  6.           flatness FLATNESS_VALUE
  7.           u_steps NUM_U_STEPS
  8.           v_steps NUM_V_STEPS
  9.           <CP1>,  <CP2>,   <CP3>,   <CP4>,
  10.           <CP5>,  <CP6>,   <CP7>,   <CP8>,
  11.           <CP9>,  <CP10>,  <CP11>,  <CP12>,
  12.           <CP13>, <CP14>,  <CP15>,  <CP16>
  13.        }
  14.  
  15.     The keyword 'type' is followed by a float PATCH_TYPE which currently must
  16.  be either 0 or 1.  For type 0 only the control points are retained within
  17.  POV-Ray.  This means that a minimal amount of memory is needed, but POV- Ray
  18.  will need to perform many extra calculations when trying to render the
  19.  patch.  Type 1 preprocesses the patch into many subpatches.  This results in
  20.  a significant speedup in rendering, at the cost of memory.
  21.  
  22.     These 4 parameters: type, flatness, u_steps & v_steps, may appear in any
  23.  order.  They are followed by 16 vectors that define the x,y,z coordinates of
  24.  the 16 control points which define the patch.  The patch touches the 4 cor-
  25.  ner points <CP1>, <CP4>, <CP13> and <CP16> while the other 12 points pull
  26.  and stretch the patch into shape.
  27.  
  28.     The keywords 'u_steps' and 'v_steps' are each followed by float values
  29.  which tell how many rows and columns of triangles are the minimum to use to
  30.  create the surface.  The maximum number of individual pieces of the patch
  31.  that are tested by POV-Ray can be calculated from the following:
  32.        sub-pieces = 2^u_steps * 2^v_steps
  33.  
  34.     This means that you really should keep 'u_steps' and 'v_steps' under 4
  35.  or 5.  Most patches look just fine with 'u_steps 3' and 'v_steps 3', which
  36.  translates to 64 subpatches (128 smooth triangles).
  37.  
  38.     As POV-Ray processes the Bezier patch, it makes a test of the current
  39.  piece of the patch to see if it is flat enough to just pretend it is a rec-
  40.  tangle.  The statement that controls this test is: 'flatness xxx'.  Typical
  41.  flatness values range from 0 to 1 (the lower the slower).
  42.  
  43.     If the value for flatness is 0, then POV-Ray will always subdivide the
  44.  patch to the extend specified by u_steps and v_steps.  If flatness is grea-
  45.  ter than 0, then every time the patch is split, POV-Ray will check to see if
  46.  there is any need to split further.
  47.  
  48.     There are both advantages and disadvantages to using a non-zero flatness.
  49.  The advantages include:
  50.        a)   If the patch isn't very curved, then this will be detected and
  51.             POV-Ray won't waste a lot of time looking at the wrong pieces.
  52.        b)   If the patch is only highly curved in a couple of places, POV-Ray
  53.             will keep subdividing there and concentrate it's efforts on the
  54.             hard part.
  55.  
  56.     The biggest disadvantage is that if POV-Ray stops subdividing at a parti-
  57.  cular level on one part of the patch and at a different level on an adjacent
  58.  part of the patch, there is the potential for 'cracking'.  This is typically
  59.  visible as spots within the patch where you can see through.  How bad this
  60.  appears depends very highly on the angle at which you are viewing the patch.
  61.  
  62.     Like triangles, the bicubic patch is not meant to be generated by hand.
  63.  These shapes should be created by a special utility.  You may be able to
  64.  acquire utilities to generate these shapes from the same source from which
  65.  you obtained POV-Ray.  For example:
  66.        bicubic_patch {
  67.           type 1
  68.           flatness 0.01
  69.           u_steps 4
  70.           v_steps 4
  71.           <0, 0, 2>, <1, 0, 0>, <2, 0, 0>, <3, 0, -2>,
  72.           <0, 1  0>, <1, 1, 0>, <2, 1, 0>, <3, 1, 0>,
  73.           <0, 2, 0>, <1, 2, 0>, <2, 2, 0>, <3, 2, 0>,
  74.           <0, 3, 2>, <1, 3, 0>, <2, 3, 0>, <3, 3, -2>
  75.        }
  76.  
  77.     The triangles in a POV-Ray bicubic_patch are automatically smoothed using
  78.  normal interpolation but it is up to the user (or the user's utility pro-
  79.  gram) to create control points which smoothly stitch together groups of
  80.  patches.
  81.  
  82.     As with the other shapes, bicubic_patch objects can be translated, rota-
  83.  ted, and scaled.  Because they are finite they respond to automatic boun-
  84.  ding.  Since it's made from triangles, a bicubic_patch cannot be used in CSG
  85.  intersection or difference types or inside a clipped_by modifier because
  86.  triangles have no clear 'inside'.  The CSG union type works acceptably.
  87.