home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Shaders / BMRTShaders / BMStucco.sl < prev    next >
Encoding:
Text File  |  1995-03-22  |  874 b   |  38 lines

  1. /*
  2.  * BMStucco.sl -- displacement shader for stucco
  3.  *
  4.  * DESCRIPTION:
  5.  *   Displacees a surface to make it look like stucco.
  6.  * 
  7.  * PARAMETERS:
  8.  *   Km            the amplitude of the stucco pimples
  9.  *   power           controls the shape of the pimples
  10.  *   frequency      the frequency of the pimples
  11.  *
  12.  *
  13.  * AUTHOR: written by Larry Gritz
  14.  *
  15.  * HISTORY:
  16.  *      May 1992 -- written by lg
  17.  *      12 Jan 1994 -- recoded by lg in correct shading language.
  18.  *
  19.  *   14 Oct 1994 - (wave) changed named to BMStucco for name space reasons...
  20.  *
  21.  * last modified Oct 14 1994 by Michael B. Johnson (wave@media.mit.edu)
  22.  */
  23.  
  24.  
  25.  
  26. displacement
  27. BMStucco ( float Km = 0.05, power = 5, frequency = 10; )
  28. {
  29.   float size;
  30.   float magnitude;
  31.   point PP;
  32.  
  33.   PP = transform ("shader", P);
  34.   magnitude = Km * pow (noise (PP*frequency), power);
  35.   P += magnitude * normalize (N);
  36.   N = calculatenormal (P);
  37. }
  38.