Mathf.PerlinNoise function, source code, question on 2D-3D implementations.

I have been doing research on Perlin Noise and it’s application in terrain generation. I wrote my version of the script in C# based on Perlin’s original code (found below), yet I still have a couple of questions on the subject.

https://mrl.nyu.edu/~perlin/noise/

1. The script returns values close to those of Mathf.PerlinNoise, but I would like to view the source code of Unity’s implementation and learn what causes the mismatch. Is there a way I could accomplish this?

2. I would like to know whether a correct 2D implementation of Perlin Noise would yield the same results as the 3D implementation, where the z property is always set to a single value (such as 0).

  1. No, we cannot release the Unity PerlinNoise code to you. Sorry.

  2. It depends on how you implement your 3D Perlin Noise. There is a 3D implementation at
    https://www.youtube.com/watch?v=Aga0TBJkchM
    . It’s great, but X, Y are all computed, so will be different from the Unity internal calculation.

Maybe a random range to the x y values on function start? Or is that what you meant with the seed? You could do some sin or cos and multiply/ add some more values in to amplify the height differences.

embarkup embarkdaily