Fix T52034: cell noise renders different.

Tweak the bias from the previous fix a bit to be more backwards compatible in
some scene. In the end which way we round is quite arbitrary, but keeping the
case where the texture coordinate is exactly zero the same seems better.
This commit is contained in:
Brecht Van Lommel 2017-07-13 12:47:41 +02:00
parent 49c29dc82f
commit 5c30bc285c
Notes: blender-bot 2023-02-14 06:48:41 +01:00
Referenced by issue #52034, Texture nodes regression in latest build of 2.78c
1 changed files with 6 additions and 6 deletions

View File

@ -1395,9 +1395,9 @@ static float voronoi_CrS(float x, float y, float z)
static float cellNoiseU(float x, float y, float z)
{
/* avoid precision issues on unit coordinates */
x = (x + 0.000001f)*0.999999f;
y = (y + 0.000001f)*0.999999f;
z = (z + 0.000001f)*0.999999f;
x = (x + 0.000001f)*1.00001f;
y = (y + 0.000001f)*1.00001f;
z = (z + 0.000001f)*1.00001f;
int xi = (int)(floor(x));
int yi = (int)(floor(y));
@ -1417,9 +1417,9 @@ float cellNoise(float x, float y, float z)
void cellNoiseV(float x, float y, float z, float ca[3])
{
/* avoid precision issues on unit coordinates */
x = (x + 0.000001f)*0.999999f;
y = (y + 0.000001f)*0.999999f;
z = (z + 0.000001f)*0.999999f;
x = (x + 0.000001f)*1.00001f;
y = (y + 0.000001f)*1.00001f;
z = (z + 0.000001f)*1.00001f;
int xi = (int)(floor(x));
int yi = (int)(floor(y));