--- ray/src/rt/normal.c 1992/05/15 13:07:55 2.18 +++ ray/src/rt/normal.c 1992/10/16 10:20:29 2.22 @@ -24,10 +24,8 @@ extern double specthresh; /* specular sampling thres extern double specjitter; /* specular sampling jitter */ /* - * This routine uses portions of the reflection - * model described by Cook and Torrance. - * The computation of specular components has been simplified by - * numerous approximations and ommisions to improve speed. + * This routine implements the isotropic Gaussian + * model described by Ward in Siggraph `92 article. * We orient the surface towards the incoming ray, so a single * surface can be used to represent an infinitely thin object. * @@ -135,9 +133,9 @@ double omega; /* light source size */ * is always modified by material color. */ /* roughness + source */ - dtmp = np->alpha2/4.0 + omega/PI; + dtmp = np->alpha2 + omega/PI; /* gaussian */ - dtmp = exp((2.*DOT(np->prdir,ldir)-2.)/dtmp)/(4.*PI*dtmp); + dtmp = exp((2.*DOT(np->prdir,ldir)-2.)/dtmp)/(PI*dtmp); /* worth using? */ if (dtmp > FTINY) { copycolor(ctmp, np->mcolor); @@ -240,8 +238,7 @@ register RAY *r; transtest = 2; } else { for (i = 0; i < 3; i++) /* perturb */ - nd.prdir[i] = r->rdir[i] - - 0.5*r->pert[i]; + nd.prdir[i] = r->rdir[i] - r->pert[i]; if (DOT(nd.prdir, r->ron) < -FTINY) normalize(nd.prdir); /* OK */ else @@ -370,7 +367,7 @@ register NORMDAT *np; if (rv[1] <= FTINY) d = 1.0; else - d = sqrt( np->alpha2/4.0 * -log(rv[1]) ); + d = sqrt( -log(rv[1]) * np->alpha2 ); for (i = 0; i < 3; i++) sr.rdir[i] = np->prdir[i] + d*(cosp*u[i] + sinp*v[i]); if (DOT(sr.rdir, r->ron) < -FTINY)