{"id":15546714,"url":"https://github.com/pvigier/perlin-numpy","last_synced_at":"2025-04-04T19:13:44.690Z","repository":{"id":46001168,"uuid":"134050320","full_name":"pvigier/perlin-numpy","owner":"pvigier","description":"A fast and simple perlin noise generator using numpy","archived":false,"fork":false,"pushed_at":"2024-02-10T21:47:35.000Z","size":6493,"stargazers_count":300,"open_issues_count":9,"forks_count":47,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-30T08:18:23.286Z","etag":null,"topics":["noise","numpy","perlin","perlin-noise"],"latest_commit_sha":null,"homepage":"https://pvigier.github.io/2018/06/13/perlin-noise-numpy.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pvigier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-19T10:00:13.000Z","updated_at":"2024-10-29T23:47:38.000Z","dependencies_parsed_at":"2022-07-18T17:00:46.241Z","dependency_job_id":"49d657dc-fcf3-469e-b04f-0862829c87c5","html_url":"https://github.com/pvigier/perlin-numpy","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.11538461538461542","last_synced_commit":"5e26837db14042e51166eb6cad4c0df2c1907016"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvigier%2Fperlin-numpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvigier%2Fperlin-numpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvigier%2Fperlin-numpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvigier%2Fperlin-numpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvigier","download_url":"https://codeload.github.com/pvigier/perlin-numpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234923,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["noise","numpy","perlin","perlin-noise"],"created_at":"2024-10-02T13:03:47.788Z","updated_at":"2025-04-04T19:13:44.666Z","avatar_url":"https://github.com/pvigier.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# perlin-numpy\n\nI wrote two articles on my blog about this project, the [first one](https://pvigier.github.io/2018/06/13/perlin-noise-numpy.html)  is about the generation of 2D noise while the [second one](https://pvigier.github.io/2018/11/02/3d-perlin-noise-numpy.html) is about the generation of 3D noise, feel free to read them!\n\nYou can find implementations using [numba](https://numba.pydata.org/) [here](https://github.com/pvigier/perlin-numpy/issues/9).\n\n## Description\n\nA fast and simple perlin noise generator using numpy.\n\n## Installation\n\nYou can install this package via:\n\n```\npip3 install git+https://github.com/pvigier/perlin-numpy\n```\n\n## Usage\n\n```python\nfrom perlin_numpy import (\n    generate_fractal_noise_2d, generate_fractal_noise_3d,\n    generate_perlin_noise_2d, generate_perlin_noise_3d\n)\n```\n\n### 2D noise\n\nThe function `generate_perlin_noise_2d` generates a 2D texture of perlin noise. Its parameters are:\n\n* `shape`: shape of the generated array (tuple of 2 ints)\n* `res`: number of periods of noise to generate along each axis (tuple of 2 ints)\n* `tileable`: if the noise should be tileable along each axis (tuple of 2 bools)\n\nNote: `shape` must be a multiple of `res`\n\nThe function `generate_fractal_noise_2d` combines several octaves of 2D perlin noise to make 2D fractal noise. Its parameters are:\n\n* `shape`: shape of the generated array (tuple of 2 ints)\n* `res`: number of periods of noise to generate along each axis (tuple of 2 ints)\n* `octaves`: number of octaves in the noise (int)\n* `persistence`: scaling factor between two octaves (float)\n* `lacunarity`: frequency factor between two octaves (float)\n* `tileable`: if the noise should be tileable along each axis (tuple of 2 bools)\n\nNote: `shape` must be a multiple of `lacunarity^(octaves-1)*res`\n\n\n### 3D noise\n\nThe function `generate_perlin_noise_3d` generates a 3D texture of perlin noise. Its parameters are:\n\n* `shape`: shape of the generated array (tuple of 3 ints)\n* `res`: number of periods of noise to generate along each axis (tuple of 3 ints)\n* `tileable`: if the noise should be tileable along each axis (tuple of 3 bools)\n\nNote: `shape` must be a multiple of `res`\n\nThe function `generate_fractal_noise_2d` combines several octaves of 3D perlin noise to make 3D fractal noise. Its parameters are:\n\n* `shape`: shape of the generated array (tuple of 3 ints)\n* `res`: number of periods of noise to generate along each axis (tuple of 3 ints)\n* `octaves`: number of octaves in the noise (int)\n* `persistence`: scaling factor between two octaves (float)\n* `lacunarity`: frequency factor between two octaves (float)\n* `tileable`: if the noise should be tileable along each axis (tuple of 3 bools)\n\nNote: `shape` must be a multiple of `lacunarity^(octaves-1)*res`\n\n## Recipes\n\nNote these snippets require [matplotlib](https://matplotlib.org/).\n\n### 2D Perlin and Fractal Noise\n\n```python\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom perlin_numpy import (\n    generate_perlin_noise_2d, generate_fractal_noise_2d\n)\n\nnp.random.seed(0)\nnoise = generate_perlin_noise_2d((256, 256), (8, 8))\nplt.imshow(noise, cmap='gray', interpolation='lanczos')\nplt.colorbar()\n\nnp.random.seed(0)\nnoise = generate_fractal_noise_2d((256, 256), (8, 8), 5)\nplt.figure()\nplt.imshow(noise, cmap='gray', interpolation='lanczos')\nplt.colorbar()\nplt.show()\n```\n\n![2D Perlin noise](https://github.com/pvigier/perlin-numpy/raw/master/examples/perlin2d.png)\n![2D fractal noise](https://github.com/pvigier/perlin-numpy/raw/master/examples/fractal2d.png)\n\n### 3D Fractal Noise\n\n```python\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\nimport numpy as np\nfrom perlin_numpy import generate_fractal_noise_3d\n\nnp.random.seed(0)\nnoise = generate_fractal_noise_3d(\n    (32, 256, 256), (1, 4, 4), 4, tileable=(True, False, False)\n)\n\nfig = plt.figure()\nimages = [\n    [plt.imshow(\n        layer, cmap='gray', interpolation='lanczos', animated=True\n    )]\n    for layer in noise\n]\nanimation_3d = animation.ArtistAnimation(fig, images, interval=50, blit=True)\nplt.show()\n```\n\n\n![3D fractal noise](https://github.com/pvigier/perlin-numpy/raw/master/examples/fractal3d.gif)\n\n### 3D Perlin Noise\n\n```python\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\nimport numpy as np\nfrom perlin_numpy import generate_perlin_noise_3d\n\nnp.random.seed(0)\nnoise = generate_perlin_noise_3d(\n    (32, 256, 256), (1, 4, 4), tileable=(True, False, False)\n)\n\nfig = plt.figure()\nimages = [\n    [plt.imshow(\n        layer, cmap='gray', interpolation='lanczos', animated=True\n    )]\n    for layer in noise\n]\nanimation_3d = animation.ArtistAnimation(fig, images, interval=50, blit=True)\nplt.show()\n```\n\n\n![3D Perlin noise](https://github.com/pvigier/perlin-numpy/raw/master/examples/perlin3d.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvigier%2Fperlin-numpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvigier%2Fperlin-numpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvigier%2Fperlin-numpy/lists"}