Math.noise(x,y,z) issue

math.noise(x,y,z) is suppose to give an answer between [-0.5,0.5] but for some reason I continue to get an answer less than -0.5. For example math.noise(1.224,0.858,4.459)=-0.50198775529861 and math.noise(1.172,0.529,283)=-0.56679427623749. I dont know if this is an issue with my parameters or the math.noise(x,y,z) function.

I might be wrong, but I’m pretty sure that Noise functions are supposed to go outside their bounds a little bit like that.

You are correct if you add multiple layers of noise together without bounding carefully. Someone should probably note this on the RobloxWiki however, or roblox can bound the noise function to [-0.5,0.5]. It can be problematic.

No they aren’t. That could screw up lots of things :open_mouth:

Yeah, it should be noted on the wiki. It shouldn’t be bounded though. Those variations help add to the natural look of heightmaps a bit. I would just make sure that you take the possible overflows into account. Perhaps plan your heightmap or whatever around the bounds of -0.7,0.7 or something.

If you have to, you can also normalize the heightmap after it is generated. To do that, you find the largest value (absolute) and divide it by your positive range. Divide that value by each value in your heightmap.

For instance, if your range is from -0.5,0.5, and the largest value is 0.6, then your numerator is going to be 0.5/0.6, which is 0.83333… For each value in your heightmap, replace it with 0.8333 / value (where value is the current heightmap value).

uhhh…Isn’t -0.501 and -0.56 greater than -0.5? Seems fine to me.

uhhh…Isn’t -0.501 and -0.56 greater than -0.5? Seems fine to me.[/quote]

For a negative number to be greater than another negative number, it needs to be closer to 0. -0.56 is farther from 0 than -0.5

[quote]
uhhh…Isn’t -0.501 and -0.56 greater than -0.5? Seems fine to me. [/quote]

No, negative 0.501 and negative 0.56 are less than negative 0.5. Positive 0.501 and positive 0.56 are greater than positive 0.5, which is also a problem

uhhh…Isn’t -0.501 and -0.56 greater than -0.5? Seems fine to me.[/quote]

For a negative number to be greater than another negative number, it needs to be closer to 0. -0.56 is farther from 0 than -0.5[/quote]

I slipped up and wasn’t thinking, my bad. Minor mistake. :oops:

To add to the discussion though, NoliCAIKS, the one who added that information about math.noise() said he was wrong. The information there is purely from his experimentation.

I’m pretty sure the bound isn’t between -.5 and .5. I’ll dive in to the code and get a better description of this function.

Having same issue.

Testing shows that for ONE DIMENSION it works correctly - [-0.5, 0.5] range

1 Like

The bounds are not between -0.5…0.5. Or rather they are… for one-dimensional noise. Probably.

I think the analysis in this thread is for original Perlin noise and we used a tweaked one so our range could be more than suggested ±0.87…

[quote] The bounds are not between -0.5…0.5. Or rather they are… for one-dimensional noise. Probably.

I think the analysis in this thread is for original Perlin noise and we used a tweaked one so our range could be more than suggested ±0.87… [/quote]

You guys should probably make a more detailed explanation on the wiki of how this works.