home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / share / k3d / shaders / displacemnt / k3d_displacementmap.sl < prev    next >
Encoding:
Text File  |  2008-01-23  |  369 b   |  16 lines

  1. displacement k3d_displacementmap(float Km = 1;
  2.                  float ZeroPoint = 0.0;
  3.                  string texturename = "";)
  4. {
  5.   point PP;
  6.   point N1, N2;
  7.   float Ct;
  8.  
  9.   Ct = (texturename != "") ? float texture(texturename) : 0;
  10.  
  11.   N1 = calculatenormal(P);
  12.   P = P - (Km * (Ct - ZeroPoint)) * normalize(N);
  13.   N2 = calculatenormal(P);
  14.   N = normalize(N) + normalize(N2) - normalize(N1);
  15. }
  16.