Cleanup: Remove unused Noise Basis texture code.
Same as last commit, code is unused and this one actually would have required some fixes, as these variants output values outside the 0-1 value range, which doesn't fit Cycles shader design.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
* from "Texturing and Modelling: A procedural approach"
|
||||
*/
|
||||
|
||||
float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float octaves)
|
||||
float noise_musgrave_fBm(point p, float H, float lacunarity, float octaves)
|
||||
{
|
||||
float rmd;
|
||||
float value = 0.0;
|
||||
@@ -54,7 +54,7 @@ float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float
|
||||
* octaves: number of frequencies in the fBm
|
||||
*/
|
||||
|
||||
float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunarity, float octaves)
|
||||
float noise_musgrave_multi_fractal(point p, float H, float lacunarity, float octaves)
|
||||
{
|
||||
float rmd;
|
||||
float value = 1.0;
|
||||
@@ -83,7 +83,7 @@ float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunar
|
||||
* offset: raises the terrain from `sea level'
|
||||
*/
|
||||
|
||||
float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacunarity, float octaves, float offset)
|
||||
float noise_musgrave_hetero_terrain(point p, float H, float lacunarity, float octaves, float offset)
|
||||
{
|
||||
float value, increment, rmd;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
@@ -118,8 +118,8 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna
|
||||
* offset: raises the terrain from `sea level'
|
||||
*/
|
||||
|
||||
float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
|
||||
float lacunarity, float octaves, float offset, float gain)
|
||||
float noise_musgrave_hybrid_multi_fractal(point p, float H, float lacunarity,
|
||||
float octaves, float offset, float gain)
|
||||
{
|
||||
float result, signal, weight, rmd;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
@@ -156,8 +156,8 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
|
||||
* offset: raises the terrain from `sea level'
|
||||
*/
|
||||
|
||||
float noise_musgrave_ridged_multi_fractal(point p, string basis, float H,
|
||||
float lacunarity, float octaves, float offset, float gain)
|
||||
float noise_musgrave_ridged_multi_fractal(point p, float H, float lacunarity,
|
||||
float octaves, float offset, float gain)
|
||||
{
|
||||
float result, signal, weight;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
@@ -201,7 +201,6 @@ shader node_musgrave_texture(
|
||||
float dimension = max(Dimension, 1e-5);
|
||||
float octaves = clamp(Detail, 0.0, 16.0);
|
||||
float lacunarity = max(Lacunarity, 1e-5);
|
||||
string Basis = "Perlin";
|
||||
float intensity = 1.0;
|
||||
|
||||
point p = Vector;
|
||||
@@ -212,15 +211,15 @@ shader node_musgrave_texture(
|
||||
p = p * Scale;
|
||||
|
||||
if (Type == "Multifractal")
|
||||
Fac = intensity * noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
|
||||
Fac = intensity * noise_musgrave_multi_fractal(p, dimension, lacunarity, octaves);
|
||||
else if (Type == "fBM")
|
||||
Fac = intensity * noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
|
||||
Fac = intensity * noise_musgrave_fBm(p, dimension, lacunarity, octaves);
|
||||
else if (Type == "Hybrid Multifractal")
|
||||
Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
|
||||
Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain);
|
||||
else if (Type == "Ridged Multifractal")
|
||||
Fac = intensity * noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
|
||||
Fac = intensity * noise_musgrave_ridged_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain);
|
||||
else if (Type == "Hetero Terrain")
|
||||
Fac = intensity * noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
|
||||
Fac = intensity * noise_musgrave_hetero_terrain(p, dimension, lacunarity, octaves, Offset);
|
||||
|
||||
Color = color(Fac, Fac, Fac);
|
||||
}
|
||||
|
@@ -19,23 +19,23 @@
|
||||
|
||||
/* Noise */
|
||||
|
||||
float noise(point p, string basis, float distortion, float detail, float fac, color Color)
|
||||
float noise(point p, float distortion, float detail, float fac, color Color)
|
||||
{
|
||||
point r;
|
||||
int hard = 0;
|
||||
|
||||
if (distortion != 0.0) {
|
||||
r[0] = noise_basis(p + point(13.5), basis) * distortion;
|
||||
r[1] = noise_basis(p, basis) * distortion;
|
||||
r[2] = noise_basis(p - point(13.5), basis) * distortion;
|
||||
r[0] = safe_noise(p + point(13.5), "unsigned") * distortion;
|
||||
r[1] = safe_noise(p, "unsigned") * distortion;
|
||||
r[2] = safe_noise(p - point(13.5), "unsigned") * distortion;
|
||||
|
||||
p += r;
|
||||
}
|
||||
|
||||
fac = noise_turbulence(p, basis, detail, hard);
|
||||
fac = noise_turbulence(p, detail, hard);
|
||||
|
||||
Color = color(fac, noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard),
|
||||
noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard));
|
||||
Color = color(fac, noise_turbulence(point(p[1], p[0], p[2]), detail, hard),
|
||||
noise_turbulence(point(p[1], p[2], p[0]), detail, hard));
|
||||
|
||||
return fac;
|
||||
}
|
||||
@@ -55,7 +55,6 @@ shader node_noise_texture(
|
||||
if (use_mapping)
|
||||
p = transform(mapping, p);
|
||||
|
||||
string Basis = "Perlin";
|
||||
Fac = noise(p * Scale, Basis, Distortion, Detail, Fac, Color);
|
||||
Fac = noise(p * Scale, Distortion, Detail, Fac, Color);
|
||||
}
|
||||
|
||||
|
@@ -106,41 +106,9 @@ float safe_noise(point p, string type)
|
||||
return f;
|
||||
}
|
||||
|
||||
float noise_basis(point p, string basis)
|
||||
{
|
||||
if (basis == "Perlin")
|
||||
return safe_noise(p, "unsigned");
|
||||
#if 0
|
||||
if (basis == "Voronoi F1")
|
||||
return voronoi_F1S(p);
|
||||
if (basis == "Voronoi F2")
|
||||
return voronoi_F2S(p);
|
||||
if (basis == "Voronoi F3")
|
||||
return voronoi_F3S(p);
|
||||
if (basis == "Voronoi F4")
|
||||
return voronoi_F4S(p);
|
||||
if (basis == "Voronoi F2-F1")
|
||||
return voronoi_F1F2S(p);
|
||||
if (basis == "Voronoi Crackle")
|
||||
return voronoi_CrS(p);
|
||||
#endif
|
||||
if (basis == "Cell Noise")
|
||||
return cellnoise(p);
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* Soft/Hard Noise */
|
||||
|
||||
float noise_basis_hard(point p, string basis, int hard)
|
||||
{
|
||||
float t = noise_basis(p, basis);
|
||||
return (hard) ? fabs(2.0 * t - 1.0) : t;
|
||||
}
|
||||
|
||||
/* Turbulence */
|
||||
|
||||
float noise_turbulence(point p, string basis, float details, int hard)
|
||||
float noise_turbulence(point p, float details, int hard)
|
||||
{
|
||||
float fscale = 1.0;
|
||||
float amp = 1.0;
|
||||
@@ -151,7 +119,7 @@ float noise_turbulence(point p, string basis, float details, int hard)
|
||||
n = (int)octaves;
|
||||
|
||||
for (i = 0; i <= n; i++) {
|
||||
float t = noise_basis(fscale * p, basis);
|
||||
float t = safe_noise(fscale * p, "unsigned");
|
||||
|
||||
if (hard)
|
||||
t = fabs(2.0 * t - 1.0);
|
||||
@@ -164,7 +132,7 @@ float noise_turbulence(point p, string basis, float details, int hard)
|
||||
float rmd = octaves - floor(octaves);
|
||||
|
||||
if (rmd != 0.0) {
|
||||
float t = noise_basis(fscale * p, basis);
|
||||
float t = safe_noise(fscale * p, "unsigned");
|
||||
|
||||
if (hard)
|
||||
t = fabs(2.0 * t - 1.0);
|
||||
|
@@ -31,7 +31,7 @@ float wave(point p, string type, float detail, float distortion, float dscale)
|
||||
}
|
||||
|
||||
if (distortion != 0.0) {
|
||||
n = n + (distortion * noise_turbulence(p * dscale, "Perlin", detail, 0));
|
||||
n = n + (distortion * noise_turbulence(p * dscale, detail, 0));
|
||||
}
|
||||
return 0.5 + 0.5 * sin(n);
|
||||
}
|
||||
|
Reference in New Issue
Block a user