Esempio n. 1
0
float Light::Cook_Torrance(Vector n, Vector l, Vector v) {
    float ndl = DotProduct(n, l);
    float ndv = DotProduct(n, v);
    float a = ndl / ndv;
    float s = 50.0f;
    float G = Geometric(n, l, v);
    float F = 0.5f;
    float D = MicroFacet(l, v, n, 0.5f);
    return a * s * F * G * D;
    // Is = (n.l)/(n.v)sFGD.Is
}
Esempio n. 2
0
   long Pascal(long n, double p)
/* ================================================= 
 * Returns a Pascal distributed non-negative integer. 
 * NOTE: use n > 0 and 0.0 < p < 1.0
 * =================================================
 */
{ 
  long i, x = 0;

  for (i = 0; i < n; i++)
    x += Geometric(p);
  return (x);
}