[Bf-blender-cvs] [5c30bc285cd] master: Fix T52034: cell noise renders different.

Brecht Van Lommel noreply at git.blender.org
Sun Jul 16 01:28:17 CEST 2017


Commit: 5c30bc285cd017daaccf4ccc7eb1d1d62cad94c9
Author: Brecht Van Lommel
Date:   Thu Jul 13 12:47:41 2017 +0200
Branches: master
https://developer.blender.org/rB5c30bc285cd017daaccf4ccc7eb1d1d62cad94c9

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.

===================================================================

M	source/blender/blenlib/intern/noise.c

===================================================================

diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 347640aae0d..86c24307ae2 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -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));




More information about the Bf-blender-cvs mailing list