--- ray/src/cv/bsdf2ttree.c 2013/08/02 20:56:19 2.17 +++ ray/src/cv/bsdf2ttree.c 2013/10/03 17:01:02 2.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.17 2013/08/02 20:56:19 greg Exp $"; +static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.19 2013/10/03 17:01:02 greg Exp $"; #endif /* * Load measured BSDF interpolant and write out as XML file with tensor tree. @@ -24,6 +24,8 @@ int samp_order = 6; const double ssamp_thresh = 0.35; /* number of super-samples */ const int nssamp = 100; + /* limit on number of RBF lobes */ +static int lobe_lim = 15000; /* Output XML prologue to stdout */ static void @@ -120,7 +122,8 @@ eval_isotropic(char *funame) data_prologue(); /* begin output */ if (pctcull >= 0) { - sprintf(cmd, "rttree_reduce -h -a -ff -r 3 -t %f -g %d", + sprintf(cmd, "rttree_reduce%s -h -ff -r 3 -t %f -g %d", + (input_orient>0 ^ output_orient>0) ? "" : " -a", pctcull, samp_order); fflush(stdout); ofp = popen(cmd, "w"); @@ -142,7 +145,7 @@ eval_isotropic(char *funame) iovec[1] = .0; iovec[2] = input_orient * sqrt(1. - iovec[0]*iovec[0]); if (funame == NULL) - rbf = advect_rbf(iovec); + rbf = advect_rbf(iovec, lobe_lim); for (ox = 0; ox < sqres; ox++) { float last_bsdf = -1; for (oy = 0; oy < sqres; oy++) { @@ -224,7 +227,8 @@ eval_anisotropic(char *funame) data_prologue(); /* begin output */ if (pctcull >= 0) { - sprintf(cmd, "rttree_reduce -h -a -ff -r 4 -t %f -g %d", + sprintf(cmd, "rttree_reduce%s -h -ff -r 4 -t %f -g %d", + (input_orient>0 ^ output_orient>0) ? "" : " -a", pctcull, samp_order); fflush(stdout); ofp = popen(cmd, "w"); @@ -246,7 +250,7 @@ eval_anisotropic(char *funame) iovec[2] = input_orient * sqrt(1. - iovec[0]*iovec[0] - iovec[1]*iovec[1]); if (funame == NULL) - rbf = advect_rbf(iovec); + rbf = advect_rbf(iovec, lobe_lim); for (ox = 0; ox < sqres; ox++) { float last_bsdf = -1; for (oy = 0; oy < sqres; oy++) { @@ -356,6 +360,9 @@ main(int argc, char *argv[]) case 'g': samp_order = atoi(argv[++i]); break; + case 'l': + lobe_lim = atoi(argv[++i]); + break; default: goto userr; } @@ -423,7 +430,7 @@ main(int argc, char *argv[]) return(0); userr: fprintf(stderr, - "Usage: %s [-g Nlog2][-t pctcull] [bsdf.sir ..] > bsdf.xml\n", + "Usage: %s [-g Nlog2][-t pctcull][-l maxlobes] [bsdf.sir ..] > bsdf.xml\n", progname); fprintf(stderr, " or: %s -t{3|4} [-g Nlog2][-t pctcull][{+|-}for[ward]][{+|-}b[ackward]][-e expr][-f file] bsdf_func > bsdf.xml\n",