Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

Discussion in 'Documentation' started by OsvaldonLT, Feb 19, 2018.

  1. OsvaldonLT

    OsvaldonLT

    Joined:
    Feb 19, 2018
    Posts:
    1
    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).
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    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
    . It's great, but X, Y are all computed, so will be different from the Unity internal calculation.
     
  3. austin112

    austin112

    Joined:
    Feb 18, 2019
    Posts:
    1
    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