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

  1. /*
  2.  * arealight.sl - light source shader appropriate for an area light source.
  3.  *
  4.  * DESCRIPTION:
  5.  *   Makes light with cosine falloff from the normal of the light source
  6.  *   surface.  This is perfect for using with area light sources.
  7.  *
  8.  * PARAMETERS
  9.  *   intensity, lightcolor - same meanings as pointlight
  10.  *
  11.  */
  12.  
  13. light k3d_arealight(
  14.     float intensity = 1;
  15.     color lightcolor = 1;
  16.     )
  17. {
  18.     N = normalize(N);
  19.  
  20.     illuminate(P, N, 1.5707963 /* PI/2 */)
  21.     {
  22.         Cl = intensity * lightcolor * (N.normalize(L)) / (L . L);
  23.     }
  24. }
  25.  
  26.