From e3784a27d6372858411ce257df6bff8984509702 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 4 Feb 2013 11:23:40 +0000 Subject: Cycles / OSL: * Fix for r53689, there are two noise types, signed and unsigned. Caused Musgrave Texture to render differently compared to SVM backend. --- intern/cycles/kernel/shaders/node_texture.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'intern/cycles/kernel/shaders/node_texture.h') diff --git a/intern/cycles/kernel/shaders/node_texture.h b/intern/cycles/kernel/shaders/node_texture.h index 2de0fc0ea57..463c68a6c27 100644 --- a/intern/cycles/kernel/shaders/node_texture.h +++ b/intern/cycles/kernel/shaders/node_texture.h @@ -151,9 +151,17 @@ float voronoi_CrS(point p) { return 2.0 * voronoi_Cr(p) - 1.0; } /* Noise Bases */ -float safe_noise(point p) +float safe_noise(point p, int type) { - float f = noise(p); + float f = 0.0; + + /* Perlin noise in range -1..1 */ + if (type == 0) + f = noise("perlin", p); + + /* Perlin noise in range 0..1 */ + else + f = noise(p); /* can happen for big coordinates, things even out to 0.5 then anyway */ if(!isfinite(f)) @@ -167,7 +175,7 @@ float noise_basis(point p, string basis) float result = 0.0; if (basis == "Perlin") - result = safe_noise(p); /* returns perlin noise in range 0..1 */ + result = safe_noise(p, 1); if (basis == "Voronoi F1") result = voronoi_F1S(p); if (basis == "Voronoi F2") -- cgit v1.2.3