From d75473e3e57e972f8b91d3debdbe65681fbeb0ef Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Fri, 18 May 2012 10:35:06 -0400 Subject: 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. --- chroma/cuda/photon.h | 13 ++++++++----- 1 file 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 -- cgit