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.48 by greg, Mon Sep 20 17:32:04 2004 UTC vs.
Revision 2.49 by greg, Wed Jan 5 19:34:11 2005 UTC

# Line 78 | Line 78 | dirnorm(               /* compute source contribution */
78   {
79          register NORMDAT *np = nnp;
80          double  ldot;
81 <        double  ldiff;
81 >        double  lrdiff, ltdiff;
82          double  dtmp, d2;
83          FVECT  vtmp;
84          COLOR  ctmp;
# Line 91 | Line 91 | dirnorm(               /* compute source contribution */
91                  return;         /* wrong side */
92  
93                                  /* Fresnel estimate */
94 <        ldiff = np->rdiff;
95 <        if (np->specfl & SP_PURE && (np->rspec > FTINY) & (ldiff > FTINY))
96 <                ldiff *= 1. - FRESNE(fabs(ldot));
94 >        lrdiff = np->rdiff;
95 >        ltdiff = np->tdiff;
96 >        if (np->specfl & SP_PURE && np->rspec > FTINY &&
97 >                        (lrdiff > FTINY) | (ltdiff > FTINY)) {
98 >                dtmp = 1. - FRESNE(fabs(ldot));
99 >                lrdiff *= dtmp;
100 >                ltdiff *= dtmp;
101 >        }
102  
103 <        if (ldot > FTINY && ldiff > FTINY) {
103 >        if (ldot > FTINY && lrdiff > FTINY) {
104                  /*
105                   *  Compute and add diffuse reflected component to returned
106                   *  color.  The diffuse reflected component will always be
107                   *  modified by the color of the material.
108                   */
109                  copycolor(ctmp, np->mcolor);
110 <                dtmp = ldot * omega * ldiff * (1.0/PI);
110 >                dtmp = ldot * omega * lrdiff * (1.0/PI);
111                  scalecolor(ctmp, dtmp);
112                  addcolor(cval, ctmp);
113          }
# Line 133 | Line 138 | dirnorm(               /* compute source contribution */
138                          addcolor(cval, ctmp);
139                  }
140          }
141 <        if (ldot < -FTINY && np->tdiff > FTINY) {
141 >        if (ldot < -FTINY && ltdiff > FTINY) {
142                  /*
143                   *  Compute diffuse transmission.
144                   */
145                  copycolor(ctmp, np->mcolor);
146 <                dtmp = -ldot * omega * np->tdiff * (1.0/PI);
146 >                dtmp = -ldot * omega * ltdiff * (1.0/PI);
147                  scalecolor(ctmp, dtmp);
148                  addcolor(cval, ctmp);
149          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines