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.58 by greg, Sun May 11 19:03:37 2014 UTC vs.
Revision 2.60 by greg, Sat May 17 00:49:17 2014 UTC

# Line 689 | Line 689 | doambient(                             /* compute ambient component */
689                                  addcolor(acol, ap->v);
690                                  ++cnt;
691                          }
692 <        if (!cnt) {
693 <                setcolor(rcol, 0.0, 0.0, 0.0);
694 <                free(hp);
695 <                return(0);              /* no valid samples */
696 <        }
697 <        if (cnt < hp->ns*hp->ns) {      /* incomplete sampling? */
692 >        if ((hp->ns < 4) | (cnt < hp->ns*hp->ns)) {
693 >                free(hp);               /* inadequate sampling */
694                  copycolor(rcol, acol);
695 <                free(hp);
700 <                return(-1);             /* return value w/o Hessian */
695 >                return(-cnt);           /* value-only result */
696          }
697          cnt = ambssamp*wt + 0.5;        /* perform super-sampling? */
698          if (cnt > 8)
# Line 705 | Line 700 | doambient(                             /* compute ambient component */
700          copycolor(rcol, acol);          /* final indirect irradiance/PI */
701          if ((ra == NULL) & (pg == NULL) & (dg == NULL)) {
702                  free(hp);
703 <                return(-1);             /* no radius or gradient calc. */
703 >                return(-1);             /* no Hessian or gradients requested */
704          }
705          if ((d = bright(acol)) > FTINY) {       /* normalize Y values */
706                  d = 0.99*(hp->ns*hp->ns)/d;
# Line 742 | Line 737 | doambient(                             /* compute ambient component */
737                          if (ra[1] < minarad)
738                                  ra[1] = minarad;
739                  }
740 <                ra[0] *= d = 1.0/sqrt(sqrt(wt));
740 >                ra[0] *= d = 1.0/sqrt(wt);
741                  if ((ra[1] *= d) > 2.0*ra[0])
742                          ra[1] = 2.0*ra[0];
743                  if (ra[1] > maxarad) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines