htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit 20b57202ba7ed7f841b64d3e732a7a6a5e61cedc
parent 85ecaa9df430539c601d18b63a6524e4af49d69b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue,  7 Apr 2020 16:00:47 +0200

Use the mrumtl_fetch_brdf2 function

Use this function to linearly interpolate the sampled BRDF.

Diffstat:
Msrc/htrdr_compute_radiance_lw.c | 2+-
Msrc/htrdr_compute_radiance_sw.c | 2+-
Msrc/htrdr_interface.c | 7++++++-
Msrc/htrdr_interface.h | 2++
4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/htrdr_compute_radiance_lw.c b/src/htrdr_compute_radiance_lw.c @@ -248,7 +248,7 @@ htrdr_compute_radiance_lw /* Fetch the hit interface and build its BSDF */ htrdr_ground_get_interface(htrdr->ground, &s3d_hit, &interf); HTRDR(interface_create_bsdf - (htrdr, &interf, ithread, wlen, pos_next, dir, &s3d_hit, &bsdf)); + (htrdr, &interf, ithread, wlen, pos_next, dir, rng, &s3d_hit, &bsdf)); d3_normalize(N, d3_set_f3(N, s3d_hit.normal)); if(d3_dot(N, wo) < 0) d3_minus(N, N); diff --git a/src/htrdr_compute_radiance_sw.c b/src/htrdr_compute_radiance_sw.c @@ -395,7 +395,7 @@ htrdr_compute_radiance_sw /* Fetch the hit interface and build its BSDF */ htrdr_ground_get_interface(htrdr->ground, &s3d_hit, &interf); HTRDR(interface_create_bsdf - (htrdr, &interf, ithread, wlen, pos_next, dir, &s3d_hit, &bsdf)); + (htrdr, &interf, ithread, wlen, pos_next, dir, rng, &s3d_hit, &bsdf)); d3_normalize(N, d3_set_f3(N, s3d_hit.normal)); if(d3_dot(N, wo) < 0) d3_minus(N, N); diff --git a/src/htrdr_interface.c b/src/htrdr_interface.c @@ -21,6 +21,7 @@ #include <star/s3d.h> #include <star/ssf.h> +#include <star/ssp.h> #include <rsys/cstr.h> #include <rsys/double3.h> @@ -108,6 +109,7 @@ htrdr_interface_create_bsdf const double wavelength, const double pos[3], const double dir[3], + struct ssp_rng* rng, struct s3d_hit* hit, struct ssf_bsdf** out_bsdf) { @@ -116,6 +118,7 @@ htrdr_interface_create_bsdf const struct mrumtl_brdf* brdf = NULL; const struct mrumtl* mat = NULL; double N[3]; + double r; int hit_side; res_T res = RES_OK; (void)pos; @@ -148,7 +151,9 @@ htrdr_interface_create_bsdf } ASSERT(mat); - res = mrumtl_fetch_brdf(mat, wavelength, &brdf); + r = ssp_rng_canonical(rng); + + res = mrumtl_fetch_brdf2(mat, wavelength, r, &brdf); if(res != RES_OK) { htrdr_log_err(htrdr, "%s: error retreiving the MruMtl BRDF for the wavelength %g.\n", diff --git a/src/htrdr_interface.h b/src/htrdr_interface.h @@ -23,6 +23,7 @@ struct mrumtl; struct s3d_hit; struct ssf_bsdf; +struct ssp_rng; struct htrdr_interface { const struct mrumtl* mtl_front; @@ -38,6 +39,7 @@ htrdr_interface_create_bsdf const double wavelength, const double pos[3], const double dir[3], /* Normalized incoming direction */ + struct ssp_rng* rng, struct s3d_hit* hit, struct ssf_bsdf** bsdf);