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.43 by greg, Fri Dec 1 02:45:14 2017 UTC vs.
Revision 2.47 by greg, Mon Feb 12 23:20:31 2018 UTC

# Line 106 | Line 106 | compute_through(BSDFDAT *ndp)
106                                          {0, -1.6},
107                                          {1.6, 0},
108                                  };
109 <        const double    peak_over = 2.0;
109 >        const double    peak_over = 1.5;
110          SDSpectralDF    *dfp;
111          FVECT           pdir;
112          double          tomega, srchrad;
# Line 142 | Line 142 | compute_through(BSDFDAT *ndp)
142                          goto baderror;
143                  cvt_sdcolor(vcol, &sv);
144                  addcolor(vsum, vcol);
145 <                if (bright(vcol) > bright(vpeak)) {
145 >                if (sv.cieY > bright(vpeak)) {
146                          copycolor(vpeak, vcol);
147                          VCOPY(pdir, tdir);
148                  }
# Line 237 | Line 237 | direct_specular_OK(COLOR cval, FVECT ldir, double omeg
237          if ((vsrc[2] > 0) ^ (ndp->vray[2] > 0) && bright(ndp->cthru) > FTINY) {
238                  double  dx = vsrc[0] + ndp->vray[0];
239                  double  dy = vsrc[1] + ndp->vray[1];
240 <                if (dx*dx + dy*dy <= (4./PI)*(omega + tomega +
240 >                if (dx*dx + dy*dy <= (1.5*4./PI)*(omega + tomega +
241                                                  2.*sqrt(omega*tomega)))
242                          return(0);
243          }
# Line 274 | Line 274 | direct_specular_OK(COLOR cval, FVECT ldir, double omeg
274                  if (tomega2 < .12*tomega)
275                          continue;       /* not safe to include */
276                  cvt_sdcolor(csmp, &sv);
277 <                                        /* weight average by Y */
278 <                scalecolor(csmp, sv.cieY);
277 >
278 >                if (sf < 2.5*tsr) {     /* weight by Y for small sources */
279 >                        scalecolor(csmp, sv.cieY);
280 >                        wtot += sv.cieY;
281 >                } else
282 >                        wtot += 1.;
283                  addcolor(cval, csmp);
280                wtot += sv.cieY;
284          }
285          if (wtot <= FTINY)              /* no valid specular samples? */
286                  return(0);
# Line 439 | Line 442 | static int
442   sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit)
443   {
444          const int       hasthru = (xmit &&
445 <                                !(ndp->pr->crtype & (SPECULAR|AMBIENT)) &&
446 <                                bright(ndp->cthru) > FTINY);
445 >                                        !(ndp->pr->crtype & (SPECULAR|AMBIENT))
446 >                                        && bright(ndp->cthru) > FTINY);
447          int             nstarget = 1;
448          int             nsent = 0;
449          int             n;
# Line 505 | Line 508 | sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit
508   static int
509   sample_sdf(BSDFDAT *ndp, int sflags)
510   {
511 <        int             hasthru = (sflags == SDsampSpT
512 <                                    && !(ndp->pr->crtype & (SPECULAR|AMBIENT))
513 <                                    && bright(ndp->cthru) > FTINY);
511 >        int             hasthru = (sflags == SDsampSpT &&
512 >                                        !(ndp->pr->crtype & (SPECULAR|AMBIENT))
513 >                                        && bright(ndp->cthru) > FTINY);
514          int             n, ntotal = 0;
515          double          b = 0;
516          SDSpectralDF    *dfp;
# Line 673 | Line 676 | m_bsdf(OBJREC *m, RAY *r)
676          if (r->crtype & SHADOW) {
677                  RAY     tr;                     /* attempt to pass shadow ray */
678                  if (rayorigin(&tr, TRANS, r, nd.cthru) < 0)
679 <                        return(1);              /* blocked */
679 >                        return(1);              /* no through component */
680                  VCOPY(tr.rdir, r->rdir);
681                  rayvalue(&tr);                  /* transmit with scaling */
682                  multcolor(tr.rcol, tr.rcoef);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines