[Bf-blender-cvs] [6d3757a] master: Better fix for T42139

Antony Riakiotakis noreply at git.blender.org
Wed Oct 15 11:05:05 CEST 2014


Commit: 6d3757a3ceb188a3fa2c423f50c1bdd670aa538a
Author: Antony Riakiotakis
Date:   Wed Oct 15 11:04:41 2014 +0200
Branches: master
https://developer.blender.org/rB6d3757a3ceb188a3fa2c423f50c1bdd670aa538a

Better fix for T42139

Noise function's significant bits are up to 31st bit. This should now
give the same visual result as before, minus the stripes.

Issue pointed out by Anthony Edlin, thanks!

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

M	source/blender/render/intern/source/render_texture.c

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

diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index d9d1acf..1a8ab60 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -723,7 +723,7 @@ static float voronoiTex(Tex *tex, const float texvec[3], TexResult *texres)
 static int texnoise(Tex *tex, TexResult *texres, int thread)
 {
 	float div=3.0;
-	int val, ran, loop, shift = 30;
+	int val, ran, loop, shift = 29;
 	
 	ran=  BLI_rng_thread_rand(random_tex_array, thread);
 	
@@ -734,8 +734,8 @@ static int texnoise(Tex *tex, TexResult *texres, int thread)
 	
 	while (loop--) {
 		shift -= 2;		
-		val += ((ran >> shift) & 3);
-		div += 3.0f;
+		val *= ((ran >> shift) & 3);
+		div *= 3.0f;
 	}
 	
 	texres->tin= ((float)val)/div;




More information about the Bf-blender-cvs mailing list