# Use perlin noise to determine how foggy it is

I wanted to make specific parts of the map foggy so i decided to use perlin noise.
Problem is i don’t understand the roblox math.noise function. Can someone help me?
The other posts are all terrain related and werent so useful for my case.

1 Like

In short, math.noise() returns a value from a 3D Perlin noise map. The map is pre-determined, so the function will always return a fixed value on a coordinate, no matter how many times you run it.

``````-- this line of code will always print 0.48397532105446 on (1.158, 5.723, 0)
print(math.noise(1.158, 5.723))
> 0.48397532105446
``````
1 Like

Can you determine how much the noise changes when you alter the values a bit

1 Like

Sure - just take the absolute difference between both noise values to determine how much it changes

``````n1 = math.noise(1.158, 5.723)
n2 = math.noise(1.054, 5.987)
print(math.abs(n2 - n1))
``````
1 Like

I meant that my noise changes from 0.4 to -0.5 when i just alter the values (math.noise(values)) by 0.01. How to fix that

1 Like

Sorry when i’m not clear enough. I am pretty new to the devforum

1 Like

Try a smaller change in values. Noise is meant to fluctuate smoothly between values but that fluctuation isn’t always guaranteed to be insignificant

Here’s an image of 2D noise that may help illustrate this

2 Likes