lm_light_shadow.sl 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_shadow(
  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 __category = "shadow";)
  22. {
  23. uniform vector A = (to - from) / length(to - from);
  24. illuminate( from, A, coneangle )
  25. {
  26. //standard shadow
  27. color shad = shadow( shadowmap, Ps, "blur", blur, "samples",samples );
  28. //float distance_squared = L.L;
  29. //float distance = sqrt( distance_squared );
  30. //float cosangle = L.A / distance;
  31. //color shad = transmission( Ps, from, "samples", samples, "samplecone", blur, "bias", .08 );
  32. //Cl = atten * (1-shad) * intensity * lightcolor;
  33. Cl = clamp((1-shad),0,1);
  34. //Cl = intensity * lightcolor;
  35. }
  36. }