diff options
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/shaders/node_musgrave_texture.osl | 24 | ||||
-rw-r--r-- | intern/cycles/kernel/shaders/node_texture.h | 6 |
2 files changed, 15 insertions, 15 deletions
diff --git a/intern/cycles/kernel/shaders/node_musgrave_texture.osl b/intern/cycles/kernel/shaders/node_musgrave_texture.osl index 60762539002..a32c3d4b1b8 100644 --- a/intern/cycles/kernel/shaders/node_musgrave_texture.osl +++ b/intern/cycles/kernel/shaders/node_musgrave_texture.osl @@ -35,14 +35,14 @@ float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float int i; for (i = 0; i < (int)octaves; i++) { - value += safe_noise(p, 0) * pwr; + value += safe_noise(p, "signed") * pwr; pwr *= pwHL; p *= lacunarity; } rmd = octaves - floor(octaves); if (rmd != 0.0) - value += rmd * safe_noise(p, 0) * pwr; + value += rmd * safe_noise(p, "signed") * pwr; return value; } @@ -63,14 +63,14 @@ float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunar int i; for (i = 0; i < (int)octaves; i++) { - value *= (pwr * safe_noise(p, 0) + 1.0); + value *= (pwr * safe_noise(p, "signed") + 1.0); pwr *= pwHL; p *= lacunarity; } rmd = octaves - floor(octaves); if (rmd != 0.0) - value *= (rmd * pwr * safe_noise(p, 0) + 1.0); /* correct? */ + value *= (rmd * pwr * safe_noise(p, "signed") + 1.0); /* correct? */ return value; } @@ -91,11 +91,11 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna int i; /* first unscaled octave of function; later octaves are scaled */ - value = offset + safe_noise(p, 0); + value = offset + safe_noise(p, "signed"); p *= lacunarity; for (i = 1; i < (int)octaves; i++) { - increment = (safe_noise(p, 0) + offset) * pwr * value; + increment = (safe_noise(p, "signed") + offset) * pwr * value; value += increment; pwr *= pwHL; p *= lacunarity; @@ -103,7 +103,7 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna rmd = octaves - floor(octaves); if (rmd != 0.0) { - increment = (safe_noise(p, 0) + offset) * pwr * value; + increment = (safe_noise(p, "signed") + offset) * pwr * value; value += rmd * increment; } @@ -126,7 +126,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, float pwr = pwHL; int i; - result = safe_noise(p, 0) + offset; + result = safe_noise(p, "signed") + offset; weight = gain * result; p *= lacunarity; @@ -134,7 +134,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, if (weight > 1.0) weight = 1.0; - signal = (safe_noise(p, 0) + offset) * pwr; + signal = (safe_noise(p, "signed") + offset) * pwr; pwr *= pwHL; result += weight * signal; weight *= gain * signal; @@ -143,7 +143,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, rmd = octaves - floor(octaves); if (rmd != 0.0) - result += rmd * ((safe_noise(p, 0) + offset) * pwr); + result += rmd * ((safe_noise(p, "signed") + offset) * pwr); return result; } @@ -164,7 +164,7 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H, float pwr = pwHL; int i; - signal = offset - fabs(safe_noise(p, 0)); + signal = offset - fabs(safe_noise(p, "signed")); signal *= signal; result = signal; weight = 1.0; @@ -172,7 +172,7 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H, for (i = 1; i < (int)octaves; i++) { p *= lacunarity; weight = clamp(signal * gain, 0.0, 1.0); - signal = offset - fabs(safe_noise(p, 0)); + signal = offset - fabs(safe_noise(p, "signed")); signal *= signal; signal *= weight; result += signal * pwr; diff --git a/intern/cycles/kernel/shaders/node_texture.h b/intern/cycles/kernel/shaders/node_texture.h index de51559f297..2710eed414a 100644 --- a/intern/cycles/kernel/shaders/node_texture.h +++ b/intern/cycles/kernel/shaders/node_texture.h @@ -153,12 +153,12 @@ float voronoi_CrS(point p) { return 2.0 * voronoi_Cr(p) - 1.0; } /* Noise Bases */ -float safe_noise(point p, int type) +float safe_noise(point p, string type) { float f = 0.0; /* Perlin noise in range -1..1 */ - if (type == 0) + if (type == "signed") f = noise("perlin", p); /* Perlin noise in range 0..1 */ @@ -175,7 +175,7 @@ float safe_noise(point p, int type) float noise_basis(point p, string basis) { if (basis == "Perlin") - return safe_noise(p, 1); + return safe_noise(p, "unsigned"); if (basis == "Voronoi F1") return voronoi_F1S(p); if (basis == "Voronoi F2") |