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

  1.     You've now rendered your first picture but it is somewhat boring.  Let's
  2.  add some fancy features to the texture.
  3.  
  4.  
  5.  Surface Finishes:
  6.  
  7.     One of the main features of a ray tracer is its ability to do interesting
  8.  things with surface finishes such as highlights and reflection.  Let's add a
  9.  nice little phong highlight (shiny spot) to the sphere.  To do this you need
  10.  a 'finish' parameter.  Change the definition of the sphere to this:
  11.        sphere {
  12.           <0, 1, 2>, 2
  13.           texture {
  14.              pigment { color Yellow }   // Yellow is predefined in
  15.              finish { phong 1 }         // COLORS.INC
  16.           }
  17.        }
  18.  
  19.     Now render this the same way you did before.  The phong keyword adds a
  20.  highlight the same color of the light shining on the object.  It adds a lot
  21.  of credibility to the picture and makes the object look smooth and shiny.
  22.  Lower values of phong will make the highlight less bright.  Phong can be
  23.  between 0 and 1.
  24.  
  25.  
  26.  Adding Bumpiness:
  27.  
  28.     The highlight you've added illustrates how much of our perception depends
  29.  on the reflective properties of an object.  Ray tracing can exploit this by
  30.  playing tricks on our perception to make us see complex details that aren't
  31.  really there.
  32.  
  33.     Suppose you wanted a very bumpy surface on the object.  It would be very
  34.  difficult to mathematically model lots of bumps.  We can however simulate
  35.  the way bumps look by altering the way light reflects off of the surface.
  36.  Reflection calculations depend on a vector called a 'surface normal' vector.
  37.  This is a vector which points away from the surface and is perpendicular to
  38.  it.  By artificially modifying (or perturbing) this normal vector you can
  39.  simulate bumps.  Change the scene to read as follows and render it:
  40.        sphere {
  41.           <0, 1, 2>, 2
  42.           texture {
  43.              pigment { color Yellow }
  44.              normal { bumps 0.4 scale 0.2 }
  45.              finish { phong 1 }
  46.           }
  47.        }
  48.  
  49.     This tells POV-Ray to use a bump pattern to modify the surface normal.
  50.  The value 0.4 controls the apparent depth of the bumps.  Usually the bumps
  51.  are about 1 unit wide which doesn't work very well with a sphere of radius
  52.  2.  The scale makes the bumps 1/5th as wide but does not affect their depth.
  53.  
  54.  
  55.  Creating Color Patterns:
  56.  
  57.     You can do more than assign a solid color to an object.  You can create
  58.  complex patterns in the pigment block.  Consider this example:
  59.        sphere {
  60.           <0, 1, 2>, 2
  61.           texture {
  62.              pigment {
  63.                 wood
  64.                 color_map {
  65.                    [0.0 color DarkTan]
  66.                    [0.9 color DarkBrown]
  67.                    [1.0 color VeryDarkBrown]
  68.                 }
  69.                 turbulence 0.05
  70.                 scale <0.2, 0.3, 1>
  71.              }
  72.              finish { phong 1 }
  73.           }
  74.        }
  75.  
  76.     The keyword 'wood' specifies a pigment pattern of concentric rings like
  77.  rings in wood.  The color_map specifies that the color of the wood should
  78.  blend from DarkTan to DarkBrown over the first 90% of the vein and from
  79.  DarkBrown to VeryDarkBrown over the remaining 10%.  The turbulence slightly
  80.  stirs up the pattern so the veins aren't perfect circles and the scale fac-
  81.  tor adjusts the size of the pattern.
  82.  
  83.     The most of the patterns are set up by default to give you one 'feature'
  84.  across a sphere of radius 1.0.  A 'feature' is very roughly defined as a co-
  85.  lor transition.  For example, a wood texture would have one band on a sphere
  86.  of radius 1.0.  In this example we scale the pattern using the 'scale' key-
  87.  word followed by a vector.  In this case we scaled 0.2 in the x direction,
  88.  0.3 in the y direction an the z direction is scaled by 1, which leaves it
  89.  unchanged.  Scale values larger than 1 will stretch an element.  Scale va-
  90.  lues smaller than one will squish an element.  And scale value 1 will leave
  91.  an element unchanged.
  92.  
  93.  
  94.  Predefined Textures:
  95.  
  96.     POV-Ray has some very sophisticated textures predefined in the standard
  97.  include files 'textures.inc' and 'stones.inc'.  Some are entire textures
  98.  with pigment, normal and/or finish parameters already defined.  Some are
  99.  just pigments or just finishes.  Change the definition of our sphere to the
  100.  following and then re-render it:
  101.        sphere {
  102.           <0, 1, 2>, 2
  103.           texture {
  104.              pigment {
  105.                 DMFWood4        // Predefined from textures.inc 
  106.                 scale 4         // Scale by 4 in all directions
  107.              }
  108.              finish { Shiny }   // This finish defined in textures.inc
  109.           }
  110.        }
  111.  
  112.     The pigment identifier DMFWood4 has already been scaled down quite small
  113.  when it was defined.  For this example we want to scale the pattern larger.
  114.  Because we want to scale it uniformly we can put a single value after the
  115.  scale keyword rather than a vector of x,y,z scale factors.
  116.  
  117.     Look through the file TEXTURES.INC to see what pigments and finishes are
  118.  defined and try them out.  Just insert the name of the new pigment where
  119.  DMFWood1 is now or try a different finish in place of Shiny and re-render
  120.  your file.
  121.  
  122.     Here is an example of using a complete texture identifier rather than
  123.  just the pieces:
  124.        sphere {
  125.           <0, 1, 2>, 2
  126.           texture { PinkAlabaster }
  127.        }
  128.