mp_light_shadow.sl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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
  9. mp_light_shadow(
  10. float intensity = 1;
  11. color lightcolor = 1;
  12. uniform string shadowmap = "";
  13. uniform float blur = 0;
  14. point from = point "shader" (0,0,0);
  15. point to = point "shader" (0,0,1);
  16. float coneangle = radians(30);
  17. float conedeltaangle = radians(5);
  18. float beamdistribution = 2;
  19. float decay = 2.0;
  20. float __nondiffuse = 0, __nonspecular = 0;
  21. float samples = 32;
  22. string __category = "shadow";)
  23. {
  24. uniform vector A = (to - from) / length(to - from);
  25. illuminate( from, A, coneangle )
  26. {
  27. //standard shadow
  28. color shad = shadow( shadowmap, 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 = clamp((1-shad),0,1);
  35. //Cl = intensity * lightcolor;
  36. }
  37. }