diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-09-09 02:37:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-09-12 13:50:44 +0300 |
commit | de6ecc82ed2d881d7a827c453a6bb97ce4b84a0d (patch) | |
tree | 3f2d030c1ea1e0bbb05811df2b7bc29e4197cf91 /intern/cycles/kernel/kernel_path_volume.h | |
parent | 28532f18672b1a2a8d3190f6ec1e7ec861699d66 (diff) |
Fix rare firefly in volume equiangular sampling when sampling short distance.
Diffstat (limited to 'intern/cycles/kernel/kernel_path_volume.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path_volume.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/intern/cycles/kernel/kernel_path_volume.h b/intern/cycles/kernel/kernel_path_volume.h index fb6b8d56a38..3fd34ed10e2 100644 --- a/intern/cycles/kernel/kernel_path_volume.h +++ b/intern/cycles/kernel/kernel_path_volume.h @@ -165,11 +165,9 @@ ccl_device void kernel_branched_path_volume_connect_light( VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); - (void)result; - kernel_assert(result == VOLUME_PATH_SCATTERED); - /* todo: split up light_sample so we don't have to call it again with new position */ - if(lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls)) { + if(result == VOLUME_PATH_SCATTERED && + lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls)) { if(kernel_data.integrator.pdf_triangles != 0.0f) ls.pdf *= 2.0f; @@ -213,11 +211,9 @@ ccl_device void kernel_branched_path_volume_connect_light( VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); - (void)result; - kernel_assert(result == VOLUME_PATH_SCATTERED); - /* todo: split up light_sample so we don't have to call it again with new position */ - if(light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { + if(result == VOLUME_PATH_SCATTERED && + light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { if(kernel_data.integrator.num_all_lights) ls.pdf *= 2.0f; @@ -252,11 +248,9 @@ ccl_device void kernel_branched_path_volume_connect_light( VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); - (void)result; - kernel_assert(result == VOLUME_PATH_SCATTERED); - /* todo: split up light_sample so we don't have to call it again with new position */ - if(light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { + if(result == VOLUME_PATH_SCATTERED && + light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { /* sample random light */ float terminate = path_state_rng_light_termination(kg, state); if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { |