Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Perlin noise, too larger differences between points

Discussion in 'World Building' started by alexooro, Jan 19, 2023.

  1. alexooro

    alexooro

    Joined:
    May 26, 2020
    Posts:
    11
    Hi,

    I'm trying to use Perlin noise to build a world, problem is, the values between points on the Perlin map are too big, for example, it goes from .3 to .4, between points, which is too large of a jump, is there a way to solve this?

    Kind regards
     
    Last edited: Feb 9, 2024
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,285
    can you show that part of the code where it calculates perlin?
     
  3. alexooro

    alexooro

    Joined:
    May 26, 2020
    Posts:
    11
    I'm using Mathf.PerlinNoise, other code doesn't influence the value, I'm passing in rather small values, points which should be different tend to be on the same point on the map, I just need more sample points on the map.
     
    Last edited: Jan 19, 2023
  4. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    What values are you passing to the noise function?
     
  5. alexooro

    alexooro

    Joined:
    May 26, 2020
    Posts:
    11
    Coordinates in world space, divided by a large number, like 500, so 16, 0, 16 in word space would be 0.032, which is too small for the perlin map, the next 5 coordinates are gonna get the same perlin value, which means the terrain isnt smooth.
     
  6. RZGames_Jethro

    RZGames_Jethro

    Joined:
    Jul 6, 2017
    Posts:
    88
    Code (CSharp):
    1. for (int k = 0; k < x; k++)
    2. {
    3.     for (int l = 0; l < z; l++)
    4.     {
    5.          float hi = Mathf.PerlinNoise(xStart + (float)k/ x, zStart + (float)l /z);
    6.     }
    7. }
    where x and z are terrain width and length
     
  7. alexooro

    alexooro

    Joined:
    May 26, 2020
    Posts:
    11
    I believe the same problem would remain, thank you though.
     
  8. alexooro

    alexooro

    Joined:
    May 26, 2020
    Posts:
    11
    Hello again,

    Just wanted to thank the people who tried to help, but I've managed to solve the issue by layering different noise maps.

    Kind regards
     
    Last edited: Feb 9, 2024