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.22 by greg, Sun Sep 2 15:33:15 2012 UTC vs.
Revision 2.27 by greg, Tue Feb 24 19:39:26 2015 UTC

# Line 13 | Line 13 | static const char RCSid[] = "$Id$";
13   #include  "func.h"
14   #include  "bsdf.h"
15   #include  "random.h"
16 + #include  "pmapmat.h"
17  
18   /*
19   *      Arguments to this material include optional diffuse colors.
# Line 122 | Line 123 | direct_bsdf_OK(COLOR cval, FVECT ldir, double omega, B
123                          return(0);
124          }
125          sf = specjitter * ndp->pr->rweight;
126 <        if (25.*tomega <= omega)
126 >        if (tomega <= .0)
127 >                nsamp = 1;
128 >        else if (25.*tomega <= omega)
129                  nsamp = 100.*sf + .5;
130          else
131                  nsamp = 4.*sf*omega/tomega + .5;
# Line 444 | Line 447 | m_bsdf(OBJREC *m, RAY *r)
447          hitfront = (r->rod > 0);
448                                                  /* load cal file */
449          mf = getfunc(m, 5, 0x1d, 1);
450 +        setfunc(m, r);
451                                                  /* get thickness */
452          nd.thick = evalue(mf->ep[0]);
453          if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
# Line 454 | Line 458 | m_bsdf(OBJREC *m, RAY *r)
458                          raytrans(r);            /* pass-through */
459                  return(1);                      /* or shadow */
460          }
461 +                                                /* check backface visibility */
462 +        if (!hitfront & !backvis) {
463 +                raytrans(r);
464 +                return(1);
465 +        }
466                                                  /* check other rays to pass */
467          if (nd.thick != 0 && (!(r->crtype & (SPECULAR|AMBIENT)) ||
468                                  nd.thick > 0 ^ hitfront)) {
469                  raytrans(r);                    /* hide our proxy */
470                  return(1);
471          }
472 +        
473 +        /* PMAP: skip ambient ray if accounted for by photon map */
474 +        if (ambRayInPmap(r))
475 +           return(1);
476 +        
477                                                  /* get BSDF data */
478          nd.sd = loadBSDF(m->oargs.sarg[1]);
479                                                  /* diffuse reflectance */
# Line 471 | Line 485 | m_bsdf(OBJREC *m, RAY *r)
485                                          m->oargs.farg[1],
486                                          m->oargs.farg[2]);
487          } else {
488 <                if (m->oargs.nfargs < 6) {      /* check invisible backside */
475 <                        if (!backvis && (nd.sd->rb == NULL) &
476 <                                        (nd.sd->tb == NULL)) {
477 <                                SDfreeCache(nd.sd);
478 <                                raytrans(r);
479 <                                return(1);
480 <                        }
488 >                if (m->oargs.nfargs < 6)
489                          setcolor(nd.rdiff, .0, .0, .0);
490 <                } else
490 >                else
491                          setcolor(nd.rdiff, m->oargs.farg[3],
492                                          m->oargs.farg[4],
493                                          m->oargs.farg[5]);
# Line 506 | Line 514 | m_bsdf(OBJREC *m, RAY *r)
514          if (mf->fxp != &unitxf) {
515                  multv3(upvec, upvec, mf->fxp->xfm);
516                  nd.thick *= mf->fxp->sca;
517 +        }
518 +        if (r->rox != NULL) {
519 +                multv3(upvec, upvec, r->rox->f.xfm);
520 +                nd.thick *= r->rox->f.sca;
521          }
522          raynormal(nd.pnorm, r);
523                                                  /* compute local BSDF xform */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines