Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
Fixed problems where BSDF evaluates to 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Feb 20, 2014
1 parent c9b9738 commit 386ac65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/cv/bsdf2rad.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: bsdf2rad.c,v 2.6 2014/02/17 21:56:22 greg Exp $";
static const char RCSid[] = "$Id: bsdf2rad.c,v 2.7 2014/02/20 09:21:32 greg Exp $";
#endif
/*
* Plot 3-D BSDF output based on scattering interpolant or XML representation
Expand Down Expand Up @@ -131,7 +131,7 @@ main(int argc, char *argv[])
for (i = 0; i < rbf->nrbf; i++) {
ovec_from_pos(odir, rbf->rbfa[i].gx, rbf->rbfa[i].gy);
bsdf = eval_rbfrep(rbf, odir) / (output_orient*odir[2]);
bsdf = log(bsdf) - min_log;
bsdf = log(bsdf + 1e-5) - min_log;
printf("pmat sphere p%d\n0\n0\n4 %f %f %f %f\n",
i+1, odir[0]*bsdf, odir[1]*bsdf, odir[2]*bsdf,
.007*bsdf);
Expand All @@ -156,7 +156,7 @@ main(int argc, char *argv[])
} else
bsdf = eval_rbfrep(rbf, odir) /
(output_orient*odir[2]);
bsdf = log(bsdf) - min_log;
bsdf = log(bsdf + 1e-5) - min_log;
fprintf(fp, "%.8e %.8e %.8e\n",
odir[0]*bsdf, odir[1]*bsdf, odir[2]*bsdf);
}
Expand Down
8 changes: 4 additions & 4 deletions src/cv/pabopto2bsdf.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: pabopto2bsdf.c,v 2.13 2014/02/17 21:56:22 greg Exp $";
static const char RCSid[] = "$Id: pabopto2bsdf.c,v 2.14 2014/02/20 09:21:32 greg Exp $";
#endif
/*
* Load measured BSDF data in PAB-Opto format.
Expand Down Expand Up @@ -231,7 +231,7 @@ main(int argc, char *argv[])
(dsf_grid[i][j].nval*output_orient*dir[2]);
if (bsdf <= bsdf_min*.6)
continue;
bsdf = log(bsdf) - min_log;
bsdf = log(bsdf + 1e-5) - min_log;
ovec_from_pos(dir, i, j);
printf("yellow sphere s%04d\n0\n0\n", ++n);
printf("4 %.6g %.6g %.6g %.6g\n\n",
Expand All @@ -245,7 +245,7 @@ main(int argc, char *argv[])
RBFVAL *rbf = &dsf_list->rbfa[n];
ovec_from_pos(dir, rbf->gx, rbf->gy);
bsdf = eval_rbfrep(dsf_list, dir) / (output_orient*dir[2]);
bsdf = log(bsdf) - min_log;
bsdf = log(bsdf + 1e-5) - min_log;
printf("red sphere p%04d\n0\n0\n", ++n);
printf("4 %.6g %.6g %.6g %.6g\n\n",
dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf,
Expand All @@ -265,7 +265,7 @@ main(int argc, char *argv[])
for (j = 0; j < GRIDRES; j++) {
ovec_from_pos(dir, i, j);
bsdf = eval_rbfrep(dsf_list, dir) / (output_orient*dir[2]);
bsdf = log(bsdf) - min_log;
bsdf = log(bsdf + 1e-5) - min_log;
fprintf(pfp, "%.8e %.8e %.8e\n",
dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf);
}
Expand Down

0 comments on commit 386ac65

Please sign in to comment.