Bake_basic.sl

[index]

10th February 2009   0:5am 1sec
/home/cleong20/Desktop/vsfx419/shaders/Bake_basic.sl


Bake_shader



surface
bake_areas2(string bakename = "", texturename = "";
            float ka = 1, Kd = 1)
{
normal Nn = normalize(N);
float a = area(P, "dicing"); // micropolygon area
float opacity = 0.333333 * (Os[0] + Os[1] + Os[2]); // average opacity
  
a *= opacity; // reduce area if non-opaque  
  
color diffcolor =1;
color tex =1;
 // Lookup diffuse texture (if any)
      if (texturename != "")
        tex = texture(texturename);
diffcolor = Cs * tex;
  
if (a > 0) {
    bake3d(bakename, "_area", P, Nn, "interpolate", 1, 
            "_area", a, "Cs", diffcolor);
            }
Ci = diffcolor * Os;
Oi = Os;
}