I am working on a terrain gen system.
I am using Perlin noise, and have come across a problem, determining the range of values.
Here is my noise function.
function Perlin(x,z,octaves,freq,amp)
freq = freq or .01
amp = amp or 10
local value = 0
for n = 1,octaves do
local noise = math.noise(x * freq +.5, .5, z * freq + .5) * amp
value = value + noise
freq = freq * 2
amp = amp / 2
end
return value
end
If I supply an Octave of 1, and Amplitude of 1, and Frequency of 1
local frequency = 1
local octaves = 1
local amplitude = 1
local noise = Perlin(x,z,octaves,frequency,amplitude)
I feel that should be the ‘base’ Perlin value.
The screenshot below, shows in the Output, that the
lowest value is -1
and highest value is 1
with Frequency of .01, I get this for high and low
with Frequency .01 and Octaves 4, I get this high and low
I need to be able to calculate these high and low values without having to pass tons of x,z into my Perlin function and compare.
I would think with knowing the base Perlin values give -1 to 1, that there would be a math formula that could determine with certain octives, frequency and amplitude, you get a range within low and high.
Any help with this or links to where I might find the solution is much appreciated.