23 |
|
extern double specthresh; /* specular sampling threshold */ |
24 |
|
extern double specjitter; /* specular sampling jitter */ |
25 |
|
|
26 |
+ |
static gaussamp(); |
27 |
+ |
|
28 |
|
/* |
29 |
|
* This routine implements the isotropic Gaussian |
30 |
|
* model described by Ward in Siggraph `92 article. |
104 |
|
/* + source if flat */ |
105 |
|
if (np->specfl & SP_FLAT) |
106 |
|
dtmp += omega/(4.0*PI); |
107 |
< |
/* delta */ |
107 |
> |
/* half vector */ |
108 |
|
vtmp[0] = ldir[0] - np->rp->rdir[0]; |
109 |
|
vtmp[1] = ldir[1] - np->rp->rdir[1]; |
110 |
|
vtmp[2] = ldir[2] - np->rp->rdir[2]; |
111 |
|
d2 = DOT(vtmp, np->pnorm); |
112 |
< |
d2 = 2.0 - 2.0*d2/sqrt(DOT(vtmp,vtmp)); |
112 |
> |
d2 *= d2; |
113 |
> |
d2 = (DOT(vtmp,vtmp) - d2) / d2; |
114 |
|
/* gaussian */ |
115 |
|
dtmp = exp(-d2/dtmp)/(4.*PI*dtmp); |
116 |
|
/* worth using? */ |