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

Comparing ray/src/rt/ambcomp.c (file contents):
Revision 2.32 by greg, Thu Apr 24 17:36:43 2014 UTC vs.
Revision 2.34 by greg, Thu Apr 24 23:15:10 2014 UTC

# Line 121 | Line 121 | ambsample(                             /* sample an ambient direction */
121          dimlist[ndims++] = i*hp->ns + j + 90171;
122          rayvalue(&ar);                  /* evaluate ray */
123          ndims--;
124 <        if (ar.rt > 20.0*maxarad)       /* limit vertex distance */
125 <                ar.rt = 20.0*maxarad;
124 >                                        /* limit vertex distance */
125 >        if (ar.rt > 10.0*thescene.cusize)
126 >                ar.rt = 10.0*thescene.cusize;
127          else if (ar.rt <= FTINY)        /* should never happen! */
128                  goto badsample;
129          VSUM(ap->p, ar.rorg, ar.rdir, ar.rt);
# Line 555 | Line 556 | doambient(                             /* compute ambient component */
556                          ra[0] = minarad;
557                          if (ra[1] < minarad)
558                                  ra[1] = minarad;
559 +                                        /* cap gradient if necessary */
560 +                        if (pg != NULL) {
561 +                                d = pg[0]*pg[0]*ra[0]*ra[0] +
562 +                                                pg[1]*pg[1]*ra[1]*ra[1];
563 +                                if (d > 1.0) {
564 +                                        d = 1.0/sqrt(d);
565 +                                        pg[0] *= d;
566 +                                        pg[1] *= d;
567 +                                }
568 +                        }
569                  }
570                  ra[0] *= d = 1.0/sqrt(sqrt(wt));
571                  if ((ra[1] *= d) > 2.0*ra[0])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines