Skip to main content

Perlin-NumPy for GPU

Project description

Perlin-CuPy: Perlin-NumPy for GPU

pypi GitHub license Author

Install | Examples

Perlin-CuPy is a Perlin-NumPy compatible library for GPU-accelerated Perlin Noise generation. Perlin-CuPy acts as a drop-in replacement to run existing Perlin-NumPy code on NVIDIA CUDA platforms.

from perlin_cupy import (
    generate_fractal_noise_2d, generate_fractal_noise_3d,
    generate_perlin_noise_2d, generate_perlin_noise_3d
)

Installation

Wheel (precompiled binary package) is available for Linux (x86_64). We've currently tested only for CUDA 11.3 platform using CuPy v11.3, but it should work for any CuPy version installed in your environment.

Platform Command
CUDA 11.3 pip install perlin-cupy

Requirements

Python Dependencies

  • CuPy: v10.0 / v10.1 / v10.2 / v11.0 / v11.1 / v11.2 / v11.3

Usage

The usage is exactly the same as Perlin-NumPy code.

2D noise

The function generate_perlin_noise_2d generates a 2D texture of perlin noise. Its parameters are:

  • shape: shape of the generated array (tuple of 2 ints)
  • res: number of periods of noise to generate along each axis (tuple of 2 ints)
  • tileable: if the noise should be tileable along each axis (tuple of 2 bools)

Note: shape must be a multiple of res

The function generate_fractal_noise_2d combines several octaves of 2D perlin noise to make 2D fractal noise. Its parameters are:

  • shape: shape of the generated array (tuple of 2 ints)
  • res: number of periods of noise to generate along each axis (tuple of 2 ints)
  • octaves: number of octaves in the noise (int)
  • persistence: scaling factor between two octaves (float)
  • lacunarity: frequency factor between two octaves (float)
  • tileable: if the noise should be tileable along each axis (tuple of 2 bools)

Note: shape must be a multiple of lacunarity^(octaves-1)*res

3D noise

The function generate_perlin_noise_3d generates a 3D texture of perlin noise. Its parameters are:

  • shape: shape of the generated array (tuple of 3 ints)
  • res: number of periods of noise to generate along each axis (tuple of 3 ints)
  • tileable: if the noise should be tileable along each axis (tuple of 3 bools)

Note: shape must be a multiple of res

The function generate_fractal_noise_2d combines several octaves of 3D perlin noise to make 3D fractal noise. Its parameters are:

  • shape: shape of the generated array (tuple of 3 ints)
  • res: number of periods of noise to generate along each axis (tuple of 3 ints)
  • octaves: number of octaves in the noise (int)
  • persistence: scaling factor between two octaves (float)
  • lacunarity: frequency factor between two octaves (float)
  • tileable: if the noise should be tileable along each axis (tuple of 3 bools)

Note: shape must be a multiple of lacunarity^(octaves-1)*res

License

MIT License (See LICENSE file).

Perlin-NumPy is designed based on Perlin-NumPy's API (see LICENSE_THIRD_PARTY file).

Perlin-CuPy is being maintained and developed by João Pedro Vasconcelos.

Icon logo made by Eucalyp from Flaticon.

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

perlin-cupy-0.0.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

perlin_cupy-0.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file perlin-cupy-0.0.3.tar.gz.

File metadata

  • Download URL: perlin-cupy-0.0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for perlin-cupy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e4cd7d56737c4754d4f8b82bd97bae31a1c28686cba681a9be731ac37f0b76af
MD5 4d482067d1206e712ddcb72f9285fa54
BLAKE2b-256 328a865b9be1169403cc970fb18377049f64eb8176d4a7de84893cd9f796ddda

See more details on using hashes here.

File details

Details for the file perlin_cupy-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: perlin_cupy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for perlin_cupy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 041b0347a389212c0591f73640b78c401154b8039997e5b5f1118659564fbc5b
MD5 de371abfc0bc18419c02a71038f32923
BLAKE2b-256 5db0b04bcd44249e5bdabc620300e7189f9fa7d88383fbe70726f9dad7dda5dc

See more details on using hashes here.

Supported by

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