From ed36398e1641819950f214026514aa9ebbfaca55 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 2 Oct 2023 17:11:53 +0200 Subject: [PATCH] Fix #109907: Cycles correlation issue with LCG random numbers This showed up in 3.6 with multiscatter GGX, but could still be an issue in current principled hair BSDF implementations. --- intern/cycles/kernel/sample/lcg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/intern/cycles/kernel/sample/lcg.h b/intern/cycles/kernel/sample/lcg.h index 6060e59d030..08c0561e65f 100644 --- a/intern/cycles/kernel/sample/lcg.h +++ b/intern/cycles/kernel/sample/lcg.h @@ -4,6 +4,8 @@ #pragma once +#include "util/hash.h" + CCL_NAMESPACE_BEGIN /* Linear Congruential Generator */ @@ -36,7 +38,7 @@ ccl_device_inline uint lcg_state_init(const uint rng_hash, const uint sample, const uint scramble) { - return lcg_init(rng_hash + rng_offset + sample * scramble); + return hash_uint3(rng_hash ^ scramble, rng_offset, sample); } CCL_NAMESPACE_END