Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LICENSE GitHub last commit PyPI GitHub release (latest by date) GitHub release (latest by date including pre-releases) PyPI - Python Version PyPI - Wheel

forthebadge forthebadge forthebadge forthebadge forthebadge

nPerlinNoise

indexed on PyPI - nPerlinNoise

repo on GitHub - nPerlinNoise

docs on ReadTheDocs -

A robust open source implementation of Perlin Noise Algorithm for N-Dimensions in Python.

  • A powerful and fast API for n-dimensional noise.
  • Easy hyper-parameters selection of octaves, lacunarity and persistence as well as complex and customizable hyper-parameters for n-dimension frequency, waveLength, warp(interpolation) and range.
  • Includes various helpful tools for noise generation and for procedural generation tasks such as customizable Gradient, Color Gradients, Warp classes.
  • Implements custom PRNG generator for n-dimension and can be easily tuned.

Details:

  • Technology stack:

    Status: v0.1.4-alpha focusing on all issues Getting Involved, follows PEP440
    All Packages: releases
    CHANGELOG

    Tested on Python 3.10, Windows 10
  • Future work:

    optimization for octave noise
    writing unit tests
    writing API docs
    writing pending docs
    writing ReadTheDocs
    blogging
    finishing left in-code docs
    dimensional octaves


Screenshots:


Dependencies

  • Python>=3.10.0

for production dependencies see Requirements
for development dependencies see Dev-Requirements

Installation

$ pip install nPerlinNoise

for detailed instruction on installation see INSTALLATION.

Usage

Setup

>>> import nPerlinNoise as nPN
>>> noise = nPN.Noise(seed=69420)

Basic usage

Get noise values at given n-dimensional coordinates by calling noise(...),
coordinates can be single value, or an iterable

  • single value

    noise(..., l, m, n, ...)
    where l, m, n, ..., are single values

    >>> noise(73)
    array(0.5207113, dtype=float32)
    >>> noise(73, 11, 7)
    array(0.5700986, dtype=float32)
    >>> noise(0, 73, 7, 11, 0, 3)
    array(0.5222712, dtype=float32)
    
  • iterable

    noise(...., [l1, l2, ..., lx], [m1, m2, ..., mx], [n1, n2, ..., nx], ....)
    where ...., are iterable of homogeneous-dimensions and lx, mx, nx, ..., are single values the output will be of same shape of input homogeneous-dimensions

    >>> noise([73, 49])
    array([0.52071124, 0.6402224 ], dtype=float32)
    >>> noise([73, 49], [2, 2])
    array([0.4563121 , 0.63378346], dtype=float32)
    >>> noise([[73], [49], [0]],
    ...       [[2 ], [2 ], [2]],
    ...       [[0 ], [1 ], [2]])
    array([[0.4563121 ],
           [0.6571784 ],
           [0.16369209]], dtype=float32)
    >>> noise([[1, 2], [2, 3]],
    ...       [[1, 1], [1, 1]],
    ...       [[2, 2], [2, 2]])
    array([[0.08666219, 0.09778494],
           [0.09778494, 0.14886124]], dtype=float32)
    

noise(..., l, m, n, ...) has same values with trailing dimensions having zero as coordinate

  • n-dimensionality

    noise(..., l, m, n) = noise(..., l, m, n, 0) = noise(..., l, m, n, 0, 0) = noise(..., l, m, n, 0, 0, ...)

    >>> noise(73)
    array(0.5207113, dtype=float32)
    >>> noise(73, 0)
    array(0.5207113, dtype=float32)
    >>> noise(73, 0, 0)
    array(0.5207113, dtype=float32)
    >>> noise(73, 0, 0, 0, 0)
    array(0.5207113, dtype=float32)
    

grid mode allows for computing noise for every combination of coords
use noise(..., gridMode=True) gridMode is key-word only argument, default=False
the output will be of shape equal to the length(s) of coords in that order

  • gridMode
    >>> noise([73, 49], [2, 2], [0, 1], gridMode=True)
    array([[[0.4563121 , 0.63378346],
            [0.4563121 , 0.63378346]],
    
           [[0.44594935, 0.6571784 ],
            [0.44594935, 0.6571784 ]]], dtype=float32)
    >>> noise([1, 20, 32, 64], [1, 1, 2], 0, [1, 2], gridMode=True)
    array([[[[0.06459193, 0.5110498 , 0.669962  , 0.47636804],
             [0.06459193, 0.5110498 , 0.669962  , 0.47636804],
             [0.09864856, 0.5013973 , 0.62935597, 0.47954425]]],
    
    
           [[[0.07678645, 0.50853723, 0.6778991 , 0.4679888 ],
             [0.07678645, 0.50853723, 0.6778991 , 0.4679888 ],
             [0.14069612, 0.47582665, 0.6663638 , 0.48764956]]]],
          dtype=float32)
    

for detailed usage see EXAMPLE

API

  • docs pending

How to test the software

to see all tests see Tests

Known issues

  • No Known Bugs
  • NPerlin.findBounds is bottleneck
  • noise(a, b, c, d, e, f, ...) is slow for single value coordinates

Getting help

  • Check main.py for detailed usage
  • Check docs for all documentations
  • Check Usage Section

If you have questions, concerns, bug reports, etc. please file an issue in this repository's Issue Tracker or open a discussion in this repository's Discussion section.

Getting involved

  • Looking for Contributors for feature additions
  • Looking for Contributors for optimization #11
  • Looking for Contributors for unit testing #12
  • Looking for Contributors for ReadTheDocs #13
  • Looking for Contributors for WebApp #14
  • Looking for Contributors for API docs #15
  • Fork the repository and issue a PR to contribute

General instructions on how to contribute CONTRIBUTING and CODE OF CONDUCT


Open source licensing info

  1. TERMS
  2. LICENSE
  3. CFPB Source Code Policy

Credits and references

  1. Inspired from The Coding Train -> perlin noise
  2. hash function by xxhash inspired the rand3 algo and ultimately helped for O(1) time complexity n-dimensional random generator NPrng
  3. StackOverflow for helping on various occasions throughout the development
  4. vnoise and opensimplex for ideas for README.md
  5. docs derivative from open-source-project-template
  6. packaging help from realpython

Maintainer:

Amith M
Instagram

Metadata

Release files for nPerlinNoise 0.1.4a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nPerlinNoise 0.1.4a0
File Size Uploaded Provenance
nPerlinNoise-0.1.4a0.tar.gz 886.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nPerlinNoise 0.1.4a0
File Interpreter ABI Platform
nPerlinNoise-0.1.4a0-py3-none-any.whl Python 3 none any Details

Total release size: 902.0 kB

Release files / nPerlinNoise-0.1.4a0.tar.gz

Download URL nPerlinNoise-0.1.4a0.tar.gz
Size 886.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7a439e991a1a8bc7f57efb63d9092dfece0fa48caeddc8a52c8dc57fd40f4032
BLAKE2b-256 checksum
How to use checksums
8a1ad5a1823240f27056daab7b5af35a58024677cf875a5c607ab7b1b0003d3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / nPerlinNoise-0.1.4a0-py3-none-any.whl

Download URL nPerlinNoise-0.1.4a0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54a0dca607f287dc673532a0d764d9cdb3805b2d16e1254f6da86f3fdfe1c2dc
BLAKE2b-256 checksum
How to use checksums
886de9c8fb43cd8b28838d58e1592de3acac9c8eb58f1dbe182e973b80f8df78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for nPerlinNoise 0.1.4a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page