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

Comparing ray/src/rt/ambient.c (file contents):
Revision 2.80 by greg, Fri Apr 25 18:38:47 2014 UTC vs.
Revision 2.82 by greg, Sat Apr 26 02:59:16 2014 UTC

# Line 129 | Line 129 | setambacc(                             /* set ambient accuracy */
129          double  newa
130   )
131   {
132 <        double  ambdiff;
133 <
134 <        if (newa < 0.0)
135 <                newa = 0.0;
136 <        ambdiff = fabs(newa - ambacc);
137 <        if (ambdiff >= .01 && (ambacc = newa) > FTINY) {
138 <                qambacc = sqrt(sqrt(ambacc));
132 >        double  olda = qambacc*qambacc*qambacc*qambacc;
133 >        
134 >        newa *= (newa > 0);
135 >        if (fabs(newa - olda) >= .05*(newa + olda)) {
136 >                qambacc = sqrt(sqrt(ambacc = newa));
137                  if (nambvals > 0)
138                          sortambvals(1);         /* rebuild tree */
139          }
# Line 152 | Line 150 | setambient(void)                               /* initialize calculation */
150          ambdone();
151                                                  /* init ambient limits */
152          setambres(ambres);
153 <        qambacc = sqrt(sqrt(ambacc *= (ambacc > FTINY)));
153 >        setambacc(ambacc);
154          if (ambfile == NULL || !ambfile[0])
155                  return;
156          if (ambacc <= FTINY) {
# Line 391 | Line 389 | sumambient(            /* get interpolated ambient value */
389                  if (delta_r2 >= maxangle*maxangle)
390                          continue;
391                  /*
392 +                 *  Modified ray behind test
393 +                 */
394 +                VSUB(ck0, av->pos, r->rop);
395 +                d = DOT(ck0, uvw[2]);
396 +                if (d < -minarad*qambacc-.001)
397 +                        continue;
398 +                d /= av->rad[0];
399 +                delta_t2 = d*d;
400 +                if (delta_t2 >= qambacc*qambacc)
401 +                        continue;
402 +                /*
403                   *  Elliptical radii test based on Hessian
404                   */
405                  decodedir(uvw[0], av->udir);
406                  VCROSS(uvw[1], uvw[2], uvw[0]);
398                VSUB(ck0, av->pos, r->rop);
407                  d = DOT(ck0, uvw[0]) / av->rad[0];
400                delta_t2 = d*d;
401                d = DOT(ck0, uvw[1]) / av->rad[1];
408                  delta_t2 += d*d;
409 <                d = DOT(ck0, uvw[2]) / av->rad[0];
409 >                d = DOT(ck0, uvw[1]) / av->rad[1];
410                  delta_t2 += d*d;
411                  if (delta_t2 >= qambacc*qambacc)
412                          continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines