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 07c3311475
commit 42eb1cc64e
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);