lm_light_spot.sl 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /****************************
  2. Shadowed Spot Light Shader
  3. (c) Mad Processor, 2009
  4. As with all baking-compatible
  5. shaders, one should not use
  6. the faceforward() call.
  7. *****************************/
  8. light lm_light_spot(
  9. float intensity = 1;
  10. color lightcolor = 1;
  11. uniform string shadowmap = "";
  12. uniform float blur = 0;
  13. point from = point "shader" (0,0,0);
  14. point to = point "shader" (0,0,1);
  15. float coneangle = radians(30);
  16. float conedeltaangle = radians(5);
  17. float beamdistribution = 2;
  18. float decay = 2.0;
  19. float __nondiffuse = 0, __nonspecular = 0;
  20. float samples = 32;
  21. string bakefile = "";
  22. string __category = "";)
  23. {
  24. uniform vector A = (to - from) / length(to - from);
  25. illuminate( from, A, coneangle )
  26. {
  27. //standard shadow
  28. color shad = shadow( "raytrace", Ps, "blur", blur, "samples", samples );
  29. //float distance_squared = L.L;
  30. //float distance = sqrt( distance_squared );
  31. //float cosangle = L.A / distance;
  32. //color shad = transmission( Ps, from, "samples", samples, "samplecone", blur, "bias", .08 );
  33. //Cl = atten * (1-shad) * intensity * lightcolor;
  34. //Cl = (1-shad) * intensity * lightcolor;
  35. //Cl = intensity * lightcolor;
  36. //Cl = 0;
  37. Cl = intensity * (1-shad);
  38. }
  39. }