Infinite Shum Perlin in python



  • I need to use Shum Perlin to develop the game, but I need an endless noise function. I mean, it should be accepted as parameters: seed - the key for which noise is generated; x and y of the points. At the end, it must be between 0 and 255. I mean, for the game, the height of the point with the cordinates. Here's the normal Shum Perlin:

    введите сюда описание изображения

    Since I didn't find a way to create an endless Suma Perlin in the python, I tried to create my own, but it didn't work out very slowly:

    Вот мой код и результат.

    Please tell me how to fix this. I don't care if it's too slow.

    I need something like: введите сюда описание изображения



  • In the end, I just installed a noise library. pip install noise in the terminal, then, on the advice of the user andreymal in the crypt, reduced the coordinates of points 0.05 and instead of seed, selected 3D noise instead of 2D in which Z was setting seed instead of the axis. It was:

    import noise
    

    s = noise.pnoise3(float(x)*0.05, float(y)0.05, seed, 1)

    Where 1 is the sound details.

    s = s100.0

    It's for use.

    The noise library can also be downloaded on the website. https://pypi.python.org/pypi/noise/




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2