lm_light_occlusion.sl 718 B

123456789101112131415161718192021222324252627
  1. /****************************
  2. Occlusion 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_occlusion(
  9. float samples = 64;
  10. string __category = "occlusion";
  11. float intensity = 1;
  12. float maxbright = 1)
  13. {
  14. normal shading_normal = normalize(Ns);
  15. //normal shading_normal = normalize(N);
  16. illuminate( Ps + shading_normal )
  17. {
  18. //timos ansatz (subtractive occlusion)
  19. //Cl = -intensity*clamp(occlusion( Ps, shading_normal, samples ),0,1);
  20. //original (additive occlusion)
  21. Cl = (1 - occlusion( Ps, shading_normal, samples )) * intensity;
  22. //bake( "occ.bake", s, t, Cl );
  23. }
  24. }