Finding the maximum and minimum possible base values of a perlin function?

I am pretty sure my code is correct. Here is my lerp function just for reference

local function lerpColor(y)
	local rgbComp = {}
	rgbComp[1] = maxColor.R+(minColor.R - maxColor.R)*math.tanh(y)
	rgbComp[2] = maxColor.G+(minColor.G - maxColor.G)*math.tanh(y)
	rgbComp[3] = maxColor.B+(minColor.B - maxColor.B)*math.tanh(y)
	print(rgbComp)
	return Color3.new(rgbComp[1], rgbComp[2], rgbComp[3])
end

However when attempting to get its base value before the amplitude part with

part.Position = Vector3.new(x, (math.noise(x/20, z/20)+2)*5, z)
		part.Anchored = true
		part.Color = lerpColor(math.noise(x/20, z/20))

I’m getting sometimes these weird spikes in the data however it works on the hills.

Could this be that due to my activation function?

EDIT: After some debugging it seems to be -0.5 and 0.5. I am not sure why, so i’ll leave this un solved for now.

Correction: it seems to go out of the bounds i describe by (so small man). It is easily noticeable however so I just made the range be -1, 1. Also,

bruh

:smirk:

5 Likes

There are no minimums or maximums, it’s a Gaussian / normal distribution around 0:

There may be some mathy way of mapping it to a finite range, e.g. between -1 and 1 or -.5 or .5, but you’re probably best off just clamping it to some range, although the noise won’t be continuous in those areas so maybe that’s a no-go for you

I understand the left and right tails approach 0 right, but what does the vertex of this graph approach on the y? Mapped it out it seems to be 0.5. Then again I am using a finite range here cause I dont know how the perlin function works. I just know how to use math.noise. I feel it is safe to say though as it seems to approach -1 and 1 but like you said, never reach there.