Shaders



dswKnurl - sinusoidal displacement shader

 
/*----------------------------------------------------------------------
 *
 * dswknurl.sl - dsward@webnation.com
 * this shader wraps a sinusoidal displacement on the surface
 * .
 * 
 * freq - "frequency" of the knurl
 * depth - magnitude of knurl
 * sORt - direction of knurl, 0=s, 1=t
 *--------------------------------------------------------------------*/
 
displacement
dswknurl(float freq = 100, depth = 0.005, sORt = 0)
{
    varying point	sN;
    varying float	position, amplitude;
 
	P = transform("shader", P);
	N = transform("shader", N + point "shader" (0,0,0));
 
	if (sORt == 0)
	{
		position = s;
	}
	else
	{
		position = t;
	}
	
	amplitude = sin(2 * PI * freq * position) - 1;
 
	P += normalize(N) * amplitude * depth;
	
	P = transform("shader", "current", P);
	N = calculatenormal(P);
}
 
 
 

 


HOME

NEW

LINKS

GALLERY

ARTICLES

PLUG-INS

RENDERMAN

Switch to Frame View




Copyright © 1997 by WebNation
All trademarks are the property of their respective holders