diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-03-26 13:13:36 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-03-27 02:08:30 +0300 |
commit | a7aee250b82161592bb673adf59508e759a867f4 (patch) | |
tree | a82f2ce17d06cfdfd5634b7a3da7cd22b219f485 /intern/cycles/kernel/kernel_random.h | |
parent | 3c45fdd171fa6ebd65f19f9fac9b204865e13136 (diff) |
Fix T54420: too much volume render noise with multiple volume objects.
Random numbers for step offset were correlated, now use stratified samples
which reduces noise as well for some types of volumes, mainly procedural
ones where the step size is bigger than the volume features.
Diffstat (limited to 'intern/cycles/kernel/kernel_random.h')
-rw-r--r-- | intern/cycles/kernel/kernel_random.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index efb9048beb8..93152e9ff1c 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -199,6 +199,19 @@ ccl_device_inline void path_state_rng_2D(KernelGlobals *kg, fx, fy); } +ccl_device_inline float path_state_rng_1D_hash(KernelGlobals *kg, + const ccl_addr_space PathState *state, + uint hash) +{ + /* Use a hash instead of dimension, this is not great but avoids adding + * more dimensions to each bounce which reduces quality of dimensions we + * are already using. */ + return path_rng_1D(kg, + cmj_hash_simple(state->rng_hash, hash), + state->sample, state->num_samples, + state->rng_offset); +} + ccl_device_inline float path_branched_rng_1D( KernelGlobals *kg, uint rng_hash, |