Skip to content

Commit

Permalink
fix: Use reciprocity for diffuse transmittance if given only one side…
Browse files Browse the repository at this point in the history
…'s BTDF
  • Loading branch information
Gregungory committed Mar 27, 2021
1 parent 925181c commit 0c628c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/common/bsdf_m.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: bsdf_m.c,v 3.41 2021/03/27 17:50:18 greg Exp $";
static const char RCSid[] = "$Id: bsdf_m.c,v 3.42 2021/03/27 20:08:30 greg Exp $";
#endif
/*
* bsdf_m.c
Expand Down Expand Up @@ -710,7 +710,12 @@ SDloadMtx(SDData *sd, ezxml_t wtl)
sd->rf = extract_diffuse(&sd->rLambFront, sd->rf);
sd->rb = extract_diffuse(&sd->rLambBack, sd->rb);
sd->tf = extract_diffuse(&sd->tLambFront, sd->tf);
sd->tb = extract_diffuse(&sd->tLambBack, sd->tb);
if (sd->tb != NULL) {
sd->tb = extract_diffuse(&sd->tLambBack, sd->tb);
if (sd->tf == NULL)
sd->tLambFront = sd->tLambBack;
} else if (sd->tf != NULL)
sd->tLambBack = sd->tLambFront;
/* return success */
return SDEnone;
}
Expand Down
9 changes: 7 additions & 2 deletions src/common/bsdf_t.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: bsdf_t.c,v 3.50 2021/03/27 17:50:18 greg Exp $";
static const char RCSid[] = "$Id: bsdf_t.c,v 3.51 2021/03/27 20:08:30 greg Exp $";
#endif
/*
* bsdf_t.c
Expand Down Expand Up @@ -1431,7 +1431,12 @@ SDloadTre(SDData *sd, ezxml_t wtl)
extract_diffuse(&sd->rLambFront, sd->rf);
extract_diffuse(&sd->rLambBack, sd->rb);
extract_diffuse(&sd->tLambFront, sd->tf);
extract_diffuse(&sd->tLambBack, sd->tb);
if (sd->tb != NULL) {
extract_diffuse(&sd->tLambBack, sd->tb);
if (sd->tf == NULL)
sd->tLambFront = sd->tLambBack;
} else if (sd->tf != NULL)
sd->tLambBack = sd->tLambFront;
/* return success */
return SDEnone;
}
Expand Down

0 comments on commit 0c628c2

Please sign in to comment.