diff options
author | Stan Seibert <stan@mtrr.org> | 2012-05-18 10:35:06 -0400 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:39 -0700 |
commit | d75473e3e57e972f8b91d3debdbe65681fbeb0ef (patch) | |
tree | 8c2fc909103553934341376374637cc088f9aeba | |
parent | 34649edf29a1cd63bcc49b91e0dcbd64ddabdc2e (diff) | |
download | chroma-d75473e3e57e972f8b91d3debdbe65681fbeb0ef.tar.gz chroma-d75473e3e57e972f8b91d3debdbe65681fbeb0ef.tar.bz2 chroma-d75473e3e57e972f8b91d3debdbe65681fbeb0ef.zip |
Change surface re-emission simulation to not use the diffuse
reflection function.
This allows the photon to reemit on either side of the surface and
also removes a spurious diffuse reflection bit in the history.
-rw-r--r-- | chroma/cuda/photon.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/chroma/cuda/photon.h b/chroma/cuda/photon.h index 0beaec4..310f09d 100644 --- a/chroma/cuda/photon.h +++ b/chroma/cuda/photon.h @@ -553,11 +553,14 @@ propagate_at_wls(Photon &p, State &s, curandState &rng, Surface *surface, bool u if (uniform_sample_reemit < reemit) { p.history |= SURFACE_REEMIT; p.wavelength = sample_cdf(&rng, surface->n, surface->wavelength0, surface->step, surface->reemission_cdf); - return propagate_at_diffuse_reflector(p, s, rng); // reemit isotropically (eh?) - } - - p.history |= SURFACE_ABSORB; - return BREAK; + p.direction = uniform_sphere(&rng); + p.polarization = cross(uniform_sphere(&rng), p.direction); + p.polarization /= norm(p.polarization); + return CONTINUE; + } else { + p.history |= SURFACE_ABSORB; + return BREAK; + } } else if (uniform_sample < absorb + reflect_specular + reflect_diffuse) { // choose how to reflect, defaulting to diffuse |