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:
parent
07c3311475
commit
42eb1cc64e
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue