Troubles understanding Perlin Noise

Hi everyone,
I’m totally new to Unity, I’m learning with all the tutorial I can find, especially those on Procedural map generation. I have trouble to understand how the Mathf.PerlinNoise() method works.

Lets just writte something like :

for( x=0 → height)
for(yy=0-> width)
noisevalue = Mathf.PerlinNoise(x,y);
noiseArray[x,y] = noisevalue;

and something like :

float divisor;
for( x → height)
for(y-> width)
noisevalue = Mathf.PerlinNoise(x/divisor,y/divisor);
noiseArray[x,y] = noisevalue;

In the first case one obtain always the same value, in the second it looks the way I wanted it (random values from 0 to 1).
I dont get why the first one doesnt work since [x,y] is different at each interation.
Is it because Mathf.PelinNoise(x,y) works in a range of one, thus always giving the same value when x and y are rational numbers ?
I tried with a few value for the divisor, ending sometime with something I like (for 0.3, 0.26, 0.7) and with a blank texture for divisors like 0.5, 0.25, 0.2. It seems only the irrational product of x/divisor and y/divisor gives results.

I’m a bit lost and the documentation for this method is not really deep ( Unity - Scripting API: Mathf.PerlinNoise ). I would really appreciate some clarifications.

Also I’m only used to terminal programmation (with a little bit of SDL with c++ for fun) and I’d like to have a terminal where I can print some simple things, like numbers or string to keep track of what the program is doing. Is there a way to add this ?

Thank you very much.

Yes, Perlin noise is periodic. It repeats every 1 unit, as I recall.

Use Debug.Print to print messages to the Console.

Thank you. I did some other tests which confirmed what you say.

Sort of. Person noise is periodic in that it passes through the same mid point value at a defined period. But it shouldn’t be repeating the sequence on either side.

The only really annoying reppititionbin Perlin is that it’s symmetrical around x=0 and y=0.

Anyway, it’s normal to use multiple overlapping sets of Perlin noise with different offsets and periods to disguise these issues.

2 Likes

looks like the actual period is 2 units!
that would make infinite terrain generation and solving floating point error possible.