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

Comparing ray/src/cv/bsdf2ttree.c (file contents):
Revision 2.43 by greg, Fri May 4 23:56:49 2018 UTC vs.
Revision 2.46 by greg, Wed May 6 02:28:21 2020 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8   */
9  
10   #define _USE_MATH_DEFINES
11 #include <stdio.h>
11   #include <stdlib.h>
12   #include <math.h>
13   #include "random.h"
# Line 26 | Line 25 | static double          pctcull = 90.;
25                                  /* sampling order */
26   static int              samp_order = 6;
27                                  /* super-sampling threshold */
28 < const double            ssamp_thresh = 0.35;
28 > const double            ssamp_thresh = 0.25;
29                                  /* number of super-samples */
30   #ifndef NSSAMP
31 < #define NSSAMP          64
31 > #define NSSAMP          256
32   #endif
33                                  /* limit on number of RBF lobes */
34   static int              lobe_lim = 15000;
# Line 192 | Line 191 | eval_isotropic(char *funame)
191                  assignD = (fundefined(funame) < 6);
192                                                  /* run through directions */
193          for (ix = 0; ix < sqres/2; ix++) {
194 <                RBFNODE *rbf = NULL;
194 >                const int       zipsgn = (ix & 1)*2 - 1;
195 >                RBFNODE         *rbf = NULL;
196                  iovec[0] = 2.*sqfact*(ix+.5) - 1.;
197 <                iovec[1] = .0;
198 <                iovec[2] = input_orient * sqrt(1. - iovec[0]*iovec[0]);
197 >                iovec[1] = zipsgn*sqfact*.5;
198 >                iovec[2] = input_orient * sqrt(1. - iovec[0]*iovec[0]
199 >                                                - iovec[1]*iovec[1]);
200                  if (funame == NULL)
201                          rbf = advect_rbf(iovec, lobe_lim);
202                  for (ox = 0; ox < sqres; ox++) {
# Line 253 | Line 254 | eval_isotropic(char *funame)
254   #if (NSSAMP > 0)
255                              if (abs_diff(bsdf, last_bsdf) > ssamp_thresh) {
256                                  int     ssi;
257 <                                double  ssa[3], ssvec[6], sum = 0;
257 >                                double  ssa[4], ssvec[6], sum = 0;
258                                                  /* super-sample voxel */
259                                  for (ssi = NSSAMP; ssi--; ) {
260 <                                    SDmultiSamp(ssa, 3, (ssi+frandom()) *
260 >                                    SDmultiSamp(ssa, 4, (ssi+frandom()) *
261                                                          (1./NSSAMP));
262                                      ssvec[0] = 2.*sqfact*(ix+ssa[0]) - 1.;
263 <                                    ssvec[1] = .0;
264 <                                    ssvec[2] = input_orient *
265 <                                                sqrt(1. - ssvec[0]*ssvec[0]);
266 <                                    SDsquare2disk(ssvec+3, (ox+ssa[1])*sqfact,
267 <                                                (oy+ssa[2])*sqfact);
263 >                                    ssvec[1] = zipsgn*sqfact*ssa[1];
264 >                                    ssvec[2] = 1. - ssvec[0]*ssvec[0]
265 >                                                        - ssvec[1]*ssvec[1];
266 >                                    if (ssvec[2] < .0) {
267 >                                        ssvec[1] = 0;
268 >                                        ssvec[2] = 1. - ssvec[0]*ssvec[0];
269 >                                    }
270 >                                    ssvec[2] = input_orient * sqrt(ssvec[2]);
271 >                                    SDsquare2disk(ssvec+3, (ox+ssa[2])*sqfact,
272 >                                                (oy+ssa[3])*sqfact);
273                                      ssvec[5] = output_orient *
274                                                  sqrt(1. - ssvec[3]*ssvec[3] -
275                                                          ssvec[4]*ssvec[4]);
# Line 627 | Line 633 | main(int argc, char *argv[])
633                  switch (argv[i][1]) {           /* get options */
634                  case 'e':
635                          scompile(argv[++i], NULL, 0);
636 +                        if (single_plane_incident < 0)
637 +                                single_plane_incident = 0;
638                          break;
639                  case 'f':
640                          if (!argv[i][2]) {
# Line 643 | Line 651 | main(int argc, char *argv[])
651                                                  return(1);
652                                          }
653                                          fcompile(fpath);
654 <                                        single_plane_incident = 0;
654 >                                        if (single_plane_incident < 0)
655 >                                                single_plane_incident = 0;
656                                  }
657                          } else
658                                  dofwd = (argv[i][0] == '+');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines