home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / share / k3d / shaders / surface / k3d_superkagee.sl < prev    next >
Encoding:
Text File  |  2008-01-23  |  3.4 KB  |  108 lines

  1.  
  2.  
  3. #define BOOL    float
  4. #define ENUM    float
  5.  
  6. #define FILT_BOX 0
  7. #define FILT_GAUSS 1
  8.  
  9. /**************************************************/
  10. /*** SHADOW ***************************************/
  11. /**************************************************/
  12.  
  13. float do_shadow6(
  14.     uniform string      theName;
  15.     varying point       thePoint;
  16.     uniform ENUM        theFilt;
  17.     uniform float       theBlur,
  18.                         theSamples,
  19.                         theBias;
  20.     ) {
  21.     uniform string filtTypes[2] = {"box", "gaussian"};
  22.     uniform string theFilterName = filtTypes[clamp(theFilt,0,1)];
  23.     float inShadow;
  24. #define SHADPOINT thePoint
  25.     inShadow = shadow (theName,
  26.                             SHADPOINT,
  27.                             "filter",   theFilterName,
  28.                             "blur",     theBlur,
  29.                             "samples",  theSamples,
  30.                             "bias",     theBias);
  31. return(inShadow);
  32. }
  33.  
  34. /******************************************************/
  35. /*** SHADER BEGINS ************************************/
  36. /******************************************************/
  37.  
  38.  
  39. surface k3d_superkagee(
  40.     color shadColor = 0;
  41.     string     shadownamea = "";
  42.             ENUM        shadowfilta = FILT_BOX;
  43.             float       shadowblura = 0,
  44.                         shadowbiasa = 0,
  45.                         shadowsamplesa = 16,
  46.                         shadowdensitya = 1;
  47.             
  48.     string     shadownameb = "";
  49.             ENUM        shadowfiltb = FILT_BOX;
  50.             float       shadowblurb = 0,
  51.                         shadowbiasb = 0,
  52.                         shadowsamplesb = 16,
  53.                         shadowdensityb = 1;
  54.             
  55.     string     shadownamec = "";
  56.             ENUM        shadowfiltc = FILT_BOX;
  57.             float       shadowblurc = 0,
  58.                         shadowbiasc = 0,
  59.                         shadowsamplesc = 16,
  60.                         shadowdensityc = 1;
  61.             
  62.     string     shadownamed = "";
  63.             ENUM        shadowfiltd = FILT_BOX;
  64.             float       shadowblurd = 0,
  65.                         shadowbiasd = 0,
  66.                         shadowsamplesd = 16,
  67.                         shadowdensityd = 1;
  68.             
  69.     
  70. ) {
  71.     uniform string rcsInfo =
  72. "$Id: k3d_superkagee.sl,v 1.1 2006/02/25 20:11:54 tshead Exp $";
  73.     varying float fullShad = 0;
  74.     varying float shadowed;
  75.     if (shadownamea != "") {
  76.         
  77.         shadowed = clamp(shadowdensitya,0,1) * do_shadow6(shadownamea,P,
  78.                     shadowfilta,shadowblura,shadowsamplesa,shadowbiasa
  79.                     
  80.                     );
  81.         fullShad = max(fullShad,shadowed);
  82.     }if (shadownameb != "") {
  83.         
  84.         shadowed = clamp(shadowdensityb,0,1) * do_shadow6(shadownameb,P,
  85.                     shadowfiltb,shadowblurb,shadowsamplesb,shadowbiasb
  86.                     
  87.                     );
  88.         fullShad = max(fullShad,shadowed);
  89.     }if (shadownamec != "") {
  90.         
  91.         shadowed = clamp(shadowdensityc,0,1) * do_shadow6(shadownamec,P,
  92.                     shadowfiltc,shadowblurc,shadowsamplesc,shadowbiasc
  93.                     
  94.                     );
  95.         fullShad = max(fullShad,shadowed);
  96.     }if (shadownamed != "") {
  97.         
  98.         shadowed = clamp(shadowdensityd,0,1) * do_shadow6(shadownamed,P,
  99.                     shadowfiltd,shadowblurd,shadowsamplesd,shadowbiasd
  100.                     
  101.                     );
  102.         fullShad = max(fullShad,shadowed);
  103.     }
  104.     Oi = Os;
  105.     Ci = Oi * mix(Cs,shadColor,fullShad);
  106. }
  107.  
  108.