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

Comparing ray/src/rt/normal.c (file contents):
Revision 2.50 by greg, Tue Apr 19 01:15:06 2005 UTC vs.
Revision 2.52 by greg, Fri May 7 15:44:52 2010 UTC

# Line 25 | Line 25 | static const char RCSid[] = "$Id$";
25   #endif
26                                          /* estimate of Fresnel function */
27   #define  FRESNE(ci)     (exp(-5.85*(ci)) - 0.00287989916)
28 + #define  FRESTHRESH     0.017999        /* minimum specularity for approx. */
29  
30  
31   /*
# Line 93 | Line 94 | dirnorm(               /* compute source contribution */
94                                  /* Fresnel estimate */
95          lrdiff = np->rdiff;
96          ltdiff = np->tdiff;
97 <        if (np->specfl & SP_PURE && np->rspec > FTINY &&
97 >        if (np->specfl & SP_PURE && np->rspec >= FRESTHRESH &&
98                          (lrdiff > FTINY) | (ltdiff > FTINY)) {
99                  dtmp = 1. - FRESNE(fabs(ldot));
100                  lrdiff *= dtmp;
# Line 155 | Line 156 | dirnorm(               /* compute source contribution */
156                                                  /* roughness + source */
157                  dtmp = np->alpha2 + omega*(1.0/PI);
158                                                  /* gaussian */
159 <                dtmp = exp((2.*DOT(np->prdir,ldir)-2.)/dtmp) /
159 <                                        (PI*np->pdot*dtmp);
159 >                 dtmp = exp((2.*DOT(np->prdir,ldir)-2.)/dtmp)/(PI*dtmp);
160                                                  /* worth using? */
161                  if (dtmp > FTINY) {
162                          copycolor(ctmp, np->mcolor);
163 <                        dtmp *= np->tspec * omega;
163 >                        dtmp *= np->tspec * omega * sqrt(-ldot/np->pdot);
164                          scalecolor(ctmp, dtmp);
165                          addcolor(cval, ctmp);
166                  }
# Line 225 | Line 225 | m_normal(                      /* color a ray that hit something normal *
225          mirdist = transdist = r->rot;
226          nd.rspec = m->oargs.farg[3];
227                                                  /* compute Fresnel approx. */
228 <        if (nd.specfl & SP_PURE && nd.rspec > FTINY) {
228 >        if (nd.specfl & SP_PURE && nd.rspec >= FRESTHRESH) {
229                  fest = FRESNE(r->rod);
230                  nd.rspec += fest*(1. - nd.rspec);
231          } else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines