Fix T46030: Strange behavior of Cycles Brick Texture

Added some extra seed to the hash, so it's now less likely to give repetitive
patters at values around zero.

This will change distribution of bricks for existing files. but it's something
inevitable.
This commit is contained in:
Sergey Sharybin 2015-09-18 17:28:40 +05:00
parent 910aaa3951
commit de7b7572c2
Notes: blender-bot 2023-02-14 11:24:03 +01:00
Referenced by issue #46161, Rotate around selection changes bezier curve handle type
Referenced by issue #46086, Smoke cache with negative start frame doesn't read cache properly
Referenced by issue #46030, Strange behavior of Cycles Brick Texture
2 changed files with 2 additions and 0 deletions

View File

@ -22,6 +22,7 @@
float brick_noise(int n) /* fast integer noise */
{
int nn;
n = (n + 1013) & 2147483647;
n = (n >> 13) ^ n;
nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 2147483647;
return 0.5 * ((float)nn / 1073741824.0);

View File

@ -21,6 +21,7 @@ CCL_NAMESPACE_BEGIN
ccl_device_noinline float brick_noise(int n) /* fast integer noise */
{
int nn;
n = (n + 1013) & 0x7fffffff;
n = (n >> 13) ^ n;
nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
return 0.5f * ((float)nn / 1073741824.0f);