Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-11-26 19:30:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-01-20 13:26:17 +0300
commit5aede15feaf154563ff6275e8f0ab4e0829de50b (patch)
treeed3247616f66b63a2786a62af1eceb879145206f /intern/cycles/kernel/kernel_random.h
parent5596f970be6346aabbe827c75833b10eb8269e66 (diff)
Cycles: Fix correlation issues in certain cases
There were two cases where correlation issues were obvious: - File from T38710 was giving issues in 2.78a again - File from T50116 was having totally different shadow between sample 1 and sample 32. Use some more simplified version of CMJ hash which seems to give nice randomized value which solves the correlation. This commit will break all unit test files, but it's a bug fix so perhaps OK to commit this. This also fixes T41143: Sobol gives nonuniform noise Proper science paper about hash function is coming. Reviewers: brecht Reviewed By: brecht Subscribers: lukasstockner97 Differential Revision: https://developer.blender.org/D2385
Diffstat (limited to 'intern/cycles/kernel/kernel_random.h')
-rw-r--r--intern/cycles/kernel/kernel_random.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h
index 2b767da5041..e773753396f 100644
--- a/intern/cycles/kernel/kernel_random.h
+++ b/intern/cycles/kernel/kernel_random.h
@@ -120,13 +120,11 @@ ccl_device_forceinline float path_rng_1D(KernelGlobals *kg, ccl_addr_space RNG *
/* Cranly-Patterson rotation using rng seed */
float shift;
- /* using the same *rng value to offset seems to give correlation issues,
- * we could hash it with the dimension but this has a performance impact,
- * we need to find a solution for this */
- if(dimension & 1)
- shift = (*rng >> 16) * (1.0f/(float)0xFFFF);
- else
- shift = (*rng & 0xFFFF) * (1.0f/(float)0xFFFF);
+ /* Hash rng with dimension to solve correlation issues.
+ * See T38710, T50116.
+ */
+ RNG tmp_rng = cmj_hash_simple(dimension, *rng);
+ shift = tmp_rng * (1.0f/(float)0xFFFFFFFF);
return r + shift - floorf(r + shift);
#endif