Table of Contents
Vectorized value & gradient noise with NumPy
Rumore is a lightweight Python library for procedural noise. It provides value noise and gradient noise in 1D/2D/3D plus octave summation of these (fractal Brownian motion, fBm).
The library does not implement Ken Perlin’s original algorithm directly, but its gradient noise produces visually similar results.
Install with PIP
pip install rumore
Install locally
Clone the repo, navigate to the directory and from there
pip install -e .
Examples
Import necessary stuff
import matplotlib.pyplot as plt
import numpy as np
import rumore
rumore.set_defaults()
Generate some 1d gradient noise with different number of octaves
x = np.linspace(-10, 10, 200)
plt.figure(figsize=(5,4))
for i in range(1, 8):
plt.plot(x, rumore.grad_noise(x, octaves=i))
plt.show()
Perturb points along a circle with 2d noise
t = np.linspace(0, np.pi*2, 200)
x = np.cos(t)
y = np.sin(t)
r = rumore.grad_noise(x, y)*0.5+0.5
plt.figure(figsize=(4,4))
plt.plot(x*r, y*r)
plt.show()
Generate a grid of 2d noise value (a grayscale image)
x = np.linspace(0, 5, 300)
y = np.linspace(0, 3, 100)
img = rumore.noise_grid(x, y)
plt.imshow(img)
plt.show()
Set noise properties. Here we set the octave_map property, defining a function that is applied to the noise of each octave.
Note that in a notebook these states are persistent, which can give unexpected results. You can reset everything by using rumore.set_defaults().
rumore.cfg.lacunarity = 2.0
rumore.cfg.falloff = 0.5 # falloff for each octave (persistence)
rumore.cfg.set_degree(5) # Interpolation degree (3 or 5)
rumore.cfg.shift = 0 #120.321 # Shift between octaves
rumore.cfg.octave_map = lambda x: np.sin(x*np.pi*4)
x = np.linspace(0, 5, 300)
y = np.linspace(0, 3, 100)
img = rumore.noise_grid(x, y)
plt.imshow(img, cmap='gray')
plt.show()
Metadata
Release files for rumore 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rumore-0.1.8.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rumore-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / rumore-0.1.8.tar.gz
| Download URL | rumore-0.1.8.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0952859dd0ae5d0c4e9116f2334682b1c108f4c46e9c3e9b0e3a3bcb9c0279a
|
|
BLAKE2b-256 checksum How to use checksums |
fa360accf6e65760841aa7bdbf554a814219740137aeb31f423c76e3cf39a9d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.8
|
Release files / rumore-0.1.8-py3-none-any.whl
| Download URL | rumore-0.1.8-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f9cf5f3aedd7f336cfd907f9c1b8e3c9a9b6b3228a295ac8b5121d2d7746013
|
|
BLAKE2b-256 checksum How to use checksums |
d623a88cbe636c7374cdddc25c00144a6207657043ed1d2308e1ad8c7d27be8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.8
|