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.59 by greg, Wed May 25 18:06:22 2005 UTC vs.
Revision 2.60 by greg, Sat May 28 22:27:54 2005 UTC

# Line 326 | Line 326 | extern double
326   sumambient(     /* get interpolated ambient value */
327          COLOR  acol,
328          register RAY  *r,
329 <        double  rw,
329 >        double  aw,
330          FVECT  rn,
331          int  al,
332          AMBTREE  *at,
# Line 352 | Line 352 | sumambient(    /* get interpolated ambient value */
352                   */
353                  if (av->lvl > al)       /* list sorted, so this works */
354                          break;
355 <                if (av->weight < 0.9*rw)
355 >                if (av->weight < 0.85*aw)
356                          continue;
357                  /*
358                   *  Ambient radius test.
# Line 431 | Line 431 | sumambient(    /* get interpolated ambient value */
431                                  break;
432                  }
433                  if (j == 3)
434 <                        wsum += sumambient(acol, r, rw, rn, al,
434 >                        wsum += sumambient(acol, r, aw, rn, al,
435                                                  at->kid+i, ck0, s);
436          }
437          return(wsum);
# Line 439 | Line 439 | sumambient(    /* get interpolated ambient value */
439  
440  
441   extern double
442 < makeambient(    /* make a new ambient value */
442 > makeambient(            /* make a new ambient value */
443          COLOR  acol,
444          RAY  *r,
445          COLOR  ac,
# Line 448 | Line 448 | makeambient(   /* make a new ambient value */
448   )
449   {
450          AMBVAL  amb;
451 <        double  coef;
451 >        double  awt;
452          FVECT   gp, gd;
453 <                                                /* compute weight */
454 <        amb.weight = pow(AVGREFL, (double)al);
455 <        coef = intens(ac)*r->rweight;
456 <        if (coef < 0.1*amb.weight)              /* heuristic */
457 <                amb.weight = coef;
453 >        int     i;
454 >
455 >        amb.weight = AVGREFL;                   /* compute weight */
456 >        for (i = al; i-- >= 0; )
457 >                amb.weight *= AVGREFL;
458 >        awt = intens(ac)*r->rweight;
459 >        if (awt < 0.07*amb.weight)              /* heuristic override */
460 >                amb.weight = 1.2*awt;
461                                                  /* compute ambient */
462          amb.rad = doambient(acol, r, ac, amb.weight, gp, gd);
463          if (amb.rad <= FTINY)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines