Hello gamedevs, I'm making a space game in Unity, and using this implementation of 3D simplex noise for the basis of my planet generation http://cabbynode.net/downloads/Noise.cs. I'm using my own function for getting noise with octaves however, since the provided one is slightly bugged and doesn't provide good results for me.
public static float fBm(Vector3 v, float seed, float scale, int octaves, bool ridged, float persistance = 0.5f, float lacunarity = 2f) {
double x = v.x + seed;
double y = v.y + seed;
double z = v.z + seed;
float total = 0.0f;
float amplitude = 1f;
float frequency = scale;
for (int i = 0; i < octaves; i++) {
total += GetNoise(x * frequency, y * frequency, z * frequency) * amplitude;
amplitude *= persistance;
frequency *= lacunarity;
}
if (ridged) {
return (1f - Mathf.Abs(total)) * 2f - 1f;
} else {
return total;
}
}
The main difference in my function is that the total noise value is not divided by the max possible amplitude at the end, like in the provided source. I don't like that because as the octaves go up, the high and low points of the noise kind of get averaged out and you end up with values from around -0.8 - 0.8f at 5 octaves for example. The downside of this is that my noise is no longer clamped between [-1f, 1f], so I'm looking for a way to add detail with the octaves but still have a nice range from [-1f, 1f].
Basically I want my octave'd noise to look like these pictures from the libnoise library http://libnoise.sourceforge.net/tutorials/tutorial4.html. In my version there is a lot less white and deep blue in the higher octaves compared to the original first octave. I've looked at the source but my function seems pretty much the same, nonetheless I've tinkered around with it a lot, but nothing has worked so far. Is it because I'm using 3D noise? Is there a property of perlin noise that helps with smooth octave generation that simplex lacks? From what I understood you could use any type of noise to generate these octaves (also called fractal brownian motion?). Maybe I am not applying the seed right or something.
Any help would be much appreciated, and I will make sure to post some sick screenies once I get my planets looking right.
Thanks!
-Buck
ps: sorry if this is the wrong subforum, figured the math experts could help me out, hah!