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.46 by greg, Mon Feb 12 18:46:29 2018 UTC vs.
Revision 2.49 by greg, Sat May 12 02:32:10 2018 UTC

# Line 116 | Line 116 | compute_through(BSDFDAT *ndp)
116  
117          setcolor(ndp->cthru, 0, 0, 0);          /* starting assumption */
118  
119        if (ndp->pr->crtype & (SPECULAR|AMBIENT) && !(ndp->pr->crtype & SHADOW))
120                return;                         /* no need for through comp. */
121
119          if (ndp->pr->rod > 0)
120                  dfp = (ndp->sd->tf != NULL) ? ndp->sd->tf : ndp->sd->tb;
121          else
# Line 240 | 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 444 | Line 441 | dir_btdf(
441   static int
442   sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit)
443   {
444 <        const int       hasthru = (xmit && bright(ndp->cthru) > FTINY);
444 >        const int       hasthru = (xmit &&
445 >                                        !(ndp->pr->crtype & (SPECULAR|AMBIENT))
446 >                                        && bright(ndp->cthru) > FTINY);
447          int             nstarget = 1;
448          int             nsent = 0;
449          int             n;
# Line 491 | Line 490 | sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit
490                  if (xmit)                       /* apply pattern on transmit */
491                          multcolor(sr.rcoef, ndp->pr->pcol);
492                  if (rayorigin(&sr, SPECULAR, ndp->pr, sr.rcoef) < 0) {
493 <                        if (maxdepth > 0)
494 <                                break;
495 <                        continue;               /* Russian roulette victim */
493 >                        if (!n & (nstarget > 1)) {
494 >                                n = nstarget;   /* avoid infinitue loop */
495 >                                nstarget = nstarget*sr.rweight/minweight;
496 >                                if (n == nstarget) break;
497 >                                n = -1;         /* moved target */
498 >                        }
499 >                        continue;               /* try again */
500                  }
501                  if (xmit && ndp->thick != 0)    /* need to offset origin? */
502                          VSUM(sr.rorg, sr.rorg, ndp->pr->ron, -ndp->thick);
# Line 510 | Line 513 | static int
513   sample_sdf(BSDFDAT *ndp, int sflags)
514   {
515          int             hasthru = (sflags == SDsampSpT &&
516 <                                        bright(ndp->cthru) > FTINY);
516 >                                        !(ndp->pr->crtype & (SPECULAR|AMBIENT))
517 >                                        && bright(ndp->cthru) > FTINY);
518          int             n, ntotal = 0;
519          double          b = 0;
520          SDSpectralDF    *dfp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines