Skip to main content

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

Project description

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

N Perlin Noise

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.3-alpha Improving docs
    All Packages: releases
    CHANGELOG

    > Tested on Python 3.10, Windows 10
  • Future work:

    optimization for higher dimensions and single value coordinates

Screenshots:

  • raw
    raw
  • wood
    wood
  • hot nebula
    hot nebula
  • island
    island
  • land
    land
  • marble fractal
    marble fractal
  • patch
    patch
  • color patch
    color patch
  • ply1
    ply1
  • ply2
    ply2
  • stripes
    stripes
  • warp
    warp

Dependencies

  • Python>=3.10.0

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

Installation

for detailed instruction on installation see INSTALLATION.

Usage

  • import nPerlinNoise as nPN
    
    noise = nPN.Noise(seed=69420)
    
  • # get noise values at given n-dimensional coordinates by calling noise with those coords
    # coordinates can be single value, or an iterable
    # noise(..., l, m, n, ...) where l, m, n, ... are single numeric values
    # or
    # noise(...., [l1, l2, ..., lx], [m1, m2, ..., mx], [n1, n2, ..., nx], ....)
    # where .... are iterable of homogeneous-dimensions
    # the output will be of same shape of input homogeneous-dimensions
    
    noise(73)  # 0.5207113
    noise(73, 11, 7)  # 0.5700986
    noise(0, 73, 7, 11, 0, 3)  # 5222712
    
    noise([73, 49])  # [0.52071124, 0.6402224]
    noise([73, 49], [2, 2])  # [0.4563121 , 0.63378346]
    
    noise([[73], [49], [0]], [[2], [2], [2]], [[0], [1], [2]])
    # -> [[0.4563121],
    #     [0.6571784],
    #     [0.16369209]]
    
    noise([[1, 2], [2, 3]], [[1, 1], [1, 1]], [[2, 2], [2, 2]])
    # -> [[0.08666219, 0.09778494],
    #     [0.09778494, 0.14886124]]
    
  • # noise(..., l, m, n, ...) has same values with trailing dimensions haveing zero as coordinate
    # i.e noise(..., l, m, n) = noise(..., l, m, n, 0) = noise(..., l, m, n, 0, 0) = noise(..., l, m, n, 0, 0, ...)
    noise(73)  # 0.5207113
    noise(73, 0)  # 0.5207113
    noise(73, 0, 0) # 0.5207113
    

for detailed usage see EXAMPLE

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 WebApps
  • Looking for Contributors for Documentation
  • Looking for Contributors for feature additions
  • Looking for Contributors for optimization
  • Fork the repository and issue a PR to contribute

General instructions on how to contribute CONTRIBUTING.


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

Maintainer:

Amith M
Instagram

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nPerlinNoise-0.1.3a1.tar.gz (2.8 MB view hashes)

Uploaded Source

Built Distribution

nPerlinNoise-0.1.3a1-py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page