/* This is project 2 for Dorothy Kwan (cs184-ch) and Tim Fitz (cs184-bg)
 *
 * PARAMETERS:
 *   Km 	   	the amplitude of the stucco pimples
 *   power	   	controls the shape of the pimples
 *   frequency  	the frequency of the pimples
 *
 */



surface
bread ( float Km = 0.05, power = 5, frequency = 10; )
{
  float magnitude;
  point PP;

  PP = transform ("shader", P);
  magnitude = Km * pow (noise (PP*frequency), power);
	if (magnitude <= 0) {
		magnitude = -magnitude;
	}
	if (magnitude < .2) {
		magnitude = magnitude + .2;
	}
	Oi = Os;
	Ci = Os*(1/magnitude)*Cs;
}