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.85 by greg, Tue May 14 17:39:10 2019 UTC vs.
Revision 2.86 by greg, Wed Feb 17 01:29:22 2021 UTC

# Line 21 | Line 21 | static const char      RCSid[] = "$Id$";
21   #include  "ambient.h"
22   #include  "random.h"
23  
24 + #ifndef MINADIV
25 + #define MINADIV         7       /* minimum # divisions in each dimension */
26 + #endif
27 +
28   extern void             SDsquare2disk(double ds[2], double seedx, double seedy);
29  
30   typedef struct {
# Line 258 | Line 262 | samp_hemi(                             /* sample indirect hemisphere */
262                          wt > (d = 0.8*intens(rcol)*r->rweight/(ambdiv*minweight)))
263                  wt = d;                 /* avoid ray termination */
264          n = sqrt(ambdiv * wt) + 0.5;
265 <        i = 1 + 5*(ambacc > FTINY);     /* minimum number of samples */
266 <        if (n < i)
265 >        i = 1 + (MINADIV-1)*(ambacc > FTINY);
266 >        if (n < i)                      /* use minimum number of samples? */
267                  n = i;
268                                          /* allocate sampling array */
269          hp = (AMBHEMI *)malloc(sizeof(AMBHEMI) + sizeof(AMBSAMP)*(n*n - 1));
# Line 291 | Line 295 | samp_hemi(                             /* sample indirect hemisphere */
295                  hp->sampOK *= -1;       /* soft failure */
296                  return(hp);
297          }
298 <        if (hp->sampOK < 64)
299 <                return(hp);             /* insufficient for super-sampling */
298 >        if (hp->sampOK <= MINADIV*MINADIV)
299 >                return(hp);             /* don't bother super-sampling */
300          n = ambssamp*wt + 0.5;
301          if (n > 8) {                    /* perform super-sampling? */
302                  ambsupersamp(hp, n);
# Line 713 | Line 717 | doambient(                             /* compute ambient component */
717                  return(0);
718  
719          if ((ra == NULL) & (pg == NULL) & (dg == NULL) ||
720 <                        (hp->sampOK < 0) | (hp->ns < 6)) {
720 >                        (hp->sampOK < 0) | (hp->ns < MINADIV)) {
721                  free(hp);               /* Hessian not requested/possible */
722                  return(-1);             /* value-only return value */
723          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines