From 148b0fef0980ab1263823ef4220d25caa0918d82 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 19 Mar 2018 20:20:01 +0100 Subject: Fix T54317: overlapping volume render bug after recent changes. Increasing the samplig dimensions like this is not optimal, I'm looking into some deeper changes to reuse the random number and change the RR probabilities, but this should fix the bug for now. --- intern/cycles/kernel/kernel_path_branched.h | 5 +---- intern/cycles/kernel/kernel_path_state.h | 17 +++++++++++++++++ intern/cycles/kernel/kernel_path_surface.h | 5 +---- .../cycles/kernel/split/kernel_next_iteration_setup.h | 5 +---- 4 files changed, 20 insertions(+), 12 deletions(-) (limited to 'intern/cycles/kernel') diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h index d43d418db29..66f67c3e2c4 100644 --- a/intern/cycles/kernel/kernel_path_branched.h +++ b/intern/cycles/kernel/kernel_path_branched.h @@ -567,10 +567,7 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg, #ifdef __VOLUME__ } else { - /* For volume bounding meshes we pass through without counting transparent - * bounces, only sanity check in case self intersection gets us stuck. */ - state.volume_bounds_bounce++; - if (state.volume_bounds_bounce > VOLUME_BOUNDS_MAX) { + if(!path_state_volume_next(kg, &state)) { break; } } diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h index ff7d1307a6c..90937dbf86e 100644 --- a/intern/cycles/kernel/kernel_path_state.h +++ b/intern/cycles/kernel/kernel_path_state.h @@ -166,6 +166,23 @@ ccl_device_inline void path_state_next(KernelGlobals *kg, ccl_addr_space PathSta #endif } +ccl_device_inline bool path_state_volume_next(KernelGlobals *kg, ccl_addr_space PathState *state) +{ + /* For volume bounding meshes we pass through without counting transparent + * bounces, only sanity check in case self intersection gets us stuck. */ + state->volume_bounds_bounce++; + if (state->volume_bounds_bounce > VOLUME_BOUNDS_MAX) { + return false; + } + + /* Random number generator next bounce. */ + if(state->volume_bounds_bounce > 1) { + state->rng_offset += PRNG_BOUNCE_NUM; + } + + return true; +} + ccl_device_inline uint path_state_ray_visibility(KernelGlobals *kg, ccl_addr_space PathState *state) { uint flag = state->flag & PATH_RAY_ALL_VISIBILITY; diff --git a/intern/cycles/kernel/kernel_path_surface.h b/intern/cycles/kernel/kernel_path_surface.h index bca346d5ee0..27be90d5059 100644 --- a/intern/cycles/kernel/kernel_path_surface.h +++ b/intern/cycles/kernel/kernel_path_surface.h @@ -329,10 +329,7 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg, } #ifdef __VOLUME__ else if(sd->flag & SD_HAS_ONLY_VOLUME) { - /* For volume bounding meshes we pass through without counting transparent - * bounces, only sanity check in case self intersection gets us stuck. */ - state->volume_bounds_bounce++; - if (state->volume_bounds_bounce > VOLUME_BOUNDS_MAX) { + if(!path_state_volume_next(kg, state)) { return false; } diff --git a/intern/cycles/kernel/split/kernel_next_iteration_setup.h b/intern/cycles/kernel/split/kernel_next_iteration_setup.h index 8092419e796..e388955f1af 100644 --- a/intern/cycles/kernel/split/kernel_next_iteration_setup.h +++ b/intern/cycles/kernel/split/kernel_next_iteration_setup.h @@ -76,10 +76,7 @@ ccl_device void kernel_split_branched_transparent_bounce(KernelGlobals *kg, int # ifdef __VOLUME__ } else { - /* For volume bounding meshes we pass through without counting transparent - * bounces, only sanity check in case self intersection gets us stuck. */ - state->volume_bounds_bounce++; - if (state->volume_bounds_bounce > VOLUME_BOUNDS_MAX) { + if(!path_state_volume_next(kg, state)) { kernel_split_path_end(kg, ray_index); return; } -- cgit v1.2.3