ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/aniso.c
(Generate patch)

Comparing ray/src/rt/aniso.c (file contents):
Revision 2.20 by greg, Wed May 20 14:23:45 1992 UTC vs.
Revision 2.23 by greg, Fri Feb 12 10:41:05 1993 UTC

# Line 20 | Line 20 | extern double  specthresh;             /* specular sampling thres
20   extern double  specjitter;              /* specular sampling jitter */
21  
22   /*
23 < *      This anisotropic reflection model uses a variant on the
24 < *  exponential Gaussian used in normal.c.
23 > *      This routine implements the anisotropic Gaussian
24 > *  model described by Ward in Siggraph `92 article.
25   *      We orient the surface towards the incoming ray, so a single
26   *  surface can be used to represent an infinitely thin object.
27   *
# Line 109 | Line 109 | double  omega;                 /* light source size */
109                  h[0] = ldir[0] - np->rp->rdir[0];
110                  h[1] = ldir[1] - np->rp->rdir[1];
111                  h[2] = ldir[2] - np->rp->rdir[2];
112                normalize(h);
112                                                  /* ellipse */
113                  dtmp1 = DOT(np->u, h);
114                  dtmp1 *= dtmp1 / au2;
115                  dtmp2 = DOT(np->v, h);
116                  dtmp2 *= dtmp2 / av2;
117                                                  /* gaussian */
118 <                dtmp = (dtmp1 + dtmp2) / (1.0 + DOT(np->pnorm, h));
119 <                dtmp = exp(-2.0*dtmp) * 1.0/(4.0*PI)
118 >                dtmp = DOT(np->pnorm, h);
119 >                dtmp = (dtmp1 + dtmp2) / (dtmp*dtmp);
120 >                dtmp = exp(-dtmp) * (0.25/PI)
121                                  * sqrt(ldot/(np->pdot*au2*av2));
122                                                  /* worth using? */
123                  if (dtmp > FTINY) {
# Line 155 | Line 155 | double  omega;                 /* light source size */
155                          dtmp = 1.0 - dtmp1*dtmp1/dtmp;
156                          if (dtmp > FTINY*FTINY) {
157                                  dtmp1 = DOT(h,np->u);
158 <                                dtmp1 = dtmp1*dtmp1 / au2;
158 >                                dtmp1 *= dtmp1 / au2;
159                                  dtmp2 = DOT(h,np->v);
160 <                                dtmp2 = dtmp2*dtmp2 / av2;
160 >                                dtmp2 *= dtmp2 / av2;
161                                  dtmp = (dtmp1 + dtmp2) / dtmp;
162                          }
163                  } else
164                          dtmp = 0.0;
165                                                  /* gaussian */
166 <                dtmp = exp(-dtmp) * 1.0/PI
166 >                dtmp = exp(-dtmp) * (1.0/PI)
167                                  * sqrt(-ldot/(np->pdot*au2*av2));
168                                                  /* worth using? */
169                  if (dtmp > FTINY) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines