keijiro / PerlinNoise

1D/2D/3D Perlin noise function for Unity
367 stars 65 forks source link

Only returns 0 #5

Closed PTTG-ACTUAL closed 3 years ago

PTTG-ACTUAL commented 3 years ago

To reproduce:

In a new unity project, create a simple scrip using the Perlin library. Do something like Debug.Log(Noise(Random.Range(0,10000), Random.Range(0,10000), Random.Range(0,10000)));.

Run the code. Watch thousands of 0 comments pile up.

This is in 2020.1. There are no error messages.

keijiro commented 3 years ago

See "Disadvantages of the perlin noise" in the following page.

http://www.angelcode.com/dev/perlin/perlin.html

Another disadvantage that might not be obvious is that the noise function always returns 0 at integer values.

Random.Range(0,10000) returns an int value. You should use Random.Range(.0f,10000.0f) instead.

keijiro commented 3 years ago

I'm closing this issue now. Please feel free to reopen it for further problems.