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

Comparing ray/src/rt/m_bsdf.c (file contents):
Revision 2.68 by greg, Thu Feb 10 16:24:51 2022 UTC vs.
Revision 2.69 by greg, Tue Mar 8 22:27:56 2022 UTC

# Line 135 | Line 135 | compute_through(BSDFDAT *ndp)
135          FVECT           pdir;
136          double          tomega, srchrad;
137          double          tomsum, tomsurr;
138 <        COLOR           vpeak, vsurr;
138 >        COLOR           vpeak, vsurr, btdiff;
139          double          vypeak;
140          int             i, ns;
141          SDError         ec;
# Line 194 | Line 194 | compute_through(BSDFDAT *ndp)
194          }
195          if (tomsurr < 0.2*tomsum)               /* insufficient surround? */
196                  return;
197        if ((vypeak/ns - (ndp->vray[2] > 0 ? ndp->sd->tLambFront.cieY
198                        : ndp->sd->tLambBack.cieY)*(1./PI))*tomsum < .0005)
199                return;                         /* < 0.05% transmission */
200        copycolor(ndp->cthru, vpeak);           /* already scaled by omega */
201        multcolor(ndp->cthru, ndp->pr->pcol);   /* modify by pattern */
197          scalecolor(vsurr, 1./tomsurr);          /* surround is avg. BTDF */
198 +        if (ndp->vray[2] > 0)                   /* get diffuse BTDF */
199 +                cvt_sdcolor(btdiff, &ndp->sd->tLambFront);
200 +        else
201 +                cvt_sdcolor(btdiff, &ndp->sd->tLambBack);
202 +        scalecolor(btdiff, (1./PI));
203 +        for (i = 3; i--; ) {                    /* remove diffuse contrib. */
204 +                if ((colval(vpeak,i) -= tomsum*colval(btdiff,i)) < 0)
205 +                        colval(vpeak,i) = 0;
206 +                if ((colval(vsurr,i) -= colval(btdiff,i)) < 0)
207 +                        colval(vsurr,i) = 0;
208 +        }
209 +        if (bright(vpeak) < .0005)              /* < 0.05% specular? */
210 +                return;
211 +        multcolor(vsurr, ndp->pr->pcol);        /* modify by color */
212 +        multcolor(vpeak, ndp->pr->pcol);
213 +        copycolor(ndp->cthru, vpeak);
214          copycolor(ndp->cthru_surr, vsurr);
204        multcolor(ndp->cthru_surr, ndp->pr->pcol);
215          return;
216   baderror:
217          objerror(ndp->mp, USER, transSDError(ec));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines