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

Comparing ray/src/rt/m_brdf.c (file contents):
Revision 2.36 by greg, Tue Nov 13 19:58:33 2018 UTC vs.
Revision 2.39 by greg, Fri Apr 19 19:01:32 2019 UTC

# Line 284 | Line 284 | m_brdf(                        /* color a ray that hit a BRDTfunc material
284                  rayvalue(&sr);
285                  multcolor(sr.rcol, sr.rcoef);
286                  addcolor(r->rcol, sr.rcol);
287 <                if (!hastexture || r->crtype & (SHADOW|AMBIENT))
287 >                if ((!hastexture || r->crtype & (SHADOW|AMBIENT)) &&
288 >                                nd.tspec > bright(nd.tdiff) + bright(nd.rdiff))
289                          r->rxt = r->rot + raydistance(&sr);
290          }
291          if (r->crtype & SHADOW)                 /* the rest is shadow */
# Line 305 | Line 306 | m_brdf(                        /* color a ray that hit a BRDTfunc material
306                  multcolor(sr.rcol, sr.rcoef);
307                  copycolor(r->mcol, sr.rcol);
308                  addcolor(r->rcol, sr.rcol);
309 +                r->rmt = r->rot;
310                  if (r->ro != NULL && isflat(r->ro->otype) &&
311                                  !hastexture | (r->crtype & AMBIENT))
312 <                        r->rmt = r->rot + raydistance(&sr);
312 >                        r->rmt += raydistance(&sr);
313          }
314                                                  /* compute ambient */
315          if (hasrefl) {
# Line 407 | Line 409 | m_brdf2(                       /* color a ray that hit a BRDF material */
409                  multambient(ctmp, r, nd.pnorm);
410                  addcolor(r->rcol, ctmp);        /* add to returned color */
411          }
412 <        if (nd.trans > FTINY) {         /* from other side */
412 >        if (nd.trans > FTINY) {                 /* from other side */
413                  flipsurface(r);
414                  vtmp[0] = -nd.pnorm[0];
415                  vtmp[1] = -nd.pnorm[1];
# Line 436 | Line 438 | setbrdfunc(                    /* set up brdf function and variables */
438                  return(0);      /* it's OK, setfunc says we're done */
439                                  /* else (re)assign special variables */
440          multv3(vec, np->pnorm, funcxf.xfm);
441 <        varset("NxP", '=', vec[0]/funcxf.sca);
442 <        varset("NyP", '=', vec[1]/funcxf.sca);
443 <        varset("NzP", '=', vec[2]/funcxf.sca);
444 <        varset("RdotP", '=', np->pdot <= -1.0 ? -1.0 :
441 >        varset("NxP`", '=', vec[0]/funcxf.sca);
442 >        varset("NyP`", '=', vec[1]/funcxf.sca);
443 >        varset("NzP`", '=', vec[2]/funcxf.sca);
444 >        varset("RdotP`", '=', np->pdot <= -1.0 ? -1.0 :
445                          np->pdot >= 1.0 ? 1.0 : np->pdot);
446          varset("CrP", '=', colval(np->mcolor,RED));
447          varset("CgP", '=', colval(np->mcolor,GRN));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines