https://github.com/takana671/noisetexture
Generating noise texture images.
https://github.com/takana671/noisetexture
cellular-noise cython domain-warping fractal noise-textures numpy periodic-noise perlin-noise python3 simplex-noise tileable-noise value-noise voronoi
Last synced: about 1 month ago
JSON representation
Generating noise texture images.
- Host: GitHub
- URL: https://github.com/takana671/noisetexture
- Owner: taKana671
- Created: 2024-10-13T03:40:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-03T10:01:28.000Z (6 months ago)
- Last Synced: 2025-12-06T12:20:52.772Z (6 months ago)
- Topics: cellular-noise, cython, domain-warping, fractal, noise-textures, numpy, periodic-noise, perlin-noise, python3, simplex-noise, tileable-noise, value-noise, voronoi
- Language: Cython
- Homepage:
- Size: 157 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NoiseTexture
This repository contains python and cython codes that can generate noise images, which can be used for textures and the heightmap to visualize the terrain in 3D.
In the python modules, numpy, and in the Cython modules, C array is mainly used. Those modules have the same functions, which return the array to be converted to an image.
Their difference is speed. See [speed comparison](#speed-comparison) result below.
I am currently trying to generate tileable noise images. See [tileable](#tileable) for noise that has become tileable.
Also submodule of
* https://github.com/taKana671/TextureGenerator
* https://github.com/taKana671/ParticleText
* https://github.com/taKana671/TerracedTerrain
# Requirements
* Cython 3.0.12
* numpy 2.2.4
* opencv-contrib-python 4.11.0.86
* opencv-python 4.11.0.86
# Environment
* Python 3.12
* Windows11
# Building Cython code
### Clone this repository.
```
git clone https://github.com/taKana671/NoiseTexture.git
```
### Build cython code.
```
cd NoiseTexture
python setup.py build_ext --inplace
```
If the error like "ModuleNotFoundError: No module named ‘distutils’" occurs, install the setuptools.
```
pip install setuptools
```
# Noise Images
### Example
```
from cynoise.perlin import PerlinNoise
# from pynoise.perlin import PerlinNoise
from output_image import output_image_8bit, output_image_16bit
maker = PerlinNoise()
arr = maker.noise3()
output_image_8bit(arr)
output_image_16bit(arr)
# change the number of lattices and the image size. The grid default is 4, size default is 256.
maker = PerlinNoise()
arr = maker.noise3(size=512, grid=8)
```
### Noise that can be generated
A noise image is output as png file.
For more details of methods and parameters, please see source codes.
***
#### Perlin Noise

***
#### Cellular Noise

***
#### Periodic Noise

***
#### Voronoi Noise


***
#### Simplex Noise

***
#### Value Noise

***
#### Tileable




# Speed comparison
The execution time of each methods were measured like below.
```
maker = VoroniNoise()
result = %timeit -o maker.noise2()
print(result.best, result.loops, result.repeat)
```
python
cython
method
best(s)
loops
repeat
best(s)
loops
repeat
PerlinNoise.noise2
1.258439
1
7
0.016928
10
7
PerlinNoise.noise3
2.113114
1
7
0.023845
10
7
PerlinNoise.noise4
4.339920
1
7
0.048453
10
7
PerlinNoise.fractal2
5.185004
1
7
0.047277
10
7
PerlinNoise.warp2_rot
21.5.049
1
7
0.167894
1
7
PerlinNoise.wrap2
20.60505
1
7
0.162479
10
7
CellularNoise.noise2
1.772891
1
7
0.034365
10
7
CellularNoise.noise3
4.445742
1
7
0.076830
10
7
CellularNoise.noise24
5.562702
1
7
0.089216
10
7
CellularNoise.cnoise2
5.574327
1
7
0.146625
10
7
CellularNoise.cnoise3
15.21613
1
7
0.330184
1
7
PeriodicNoise.noise2
1.511534
1
7
0.017240
100
7
PeriodicNoise.noise3
2.522443
1
7
0.023741
10
7
VoronoiNoise.noise2
1.782102
1
7
0.113907
10
7
VoronoiNoise.noise3
4.200216
1
7
0.179295
10
7
VoronoiEdges.noise2
16.96586
1
7
0.195019
1
7
VoronoiEdges.noise3
83.08460
1
7
1.026584
1
7
VoronoiRoundEdges.noise2
18.23457
1
7
0.245364
1
7
VoronoiRoundEdges.noise3
84.45329
1
7
1.233588
1
7
SimplexNoise.noise2
1.656967
1
7
0.020974
10
7
SimplexNoise.noise3
4.337698
1
7
0.024148
10
7
SimplexNoise.fractal2
6.711880
1
7
0.065214
10
7
SimplexNoise.fractal3
17.35970
1
7
0.083178
10
7
ValueNoise.noise2
1.128080
1
7
0.016823
100
7
ValueNoise.noise3
1.566021
1
7
0.022034
10
7
ValueNoise.grad2
3.875698
1
7
0.034712
10
7
ValueNoise.fractal2
3.839937
1
7
0.041812
10
7
ValueNoise.warp2_rot
16.90730
1
7
0.151481
10
7
ValueNoise.warp2
15.49489
1
7
0.142454
10
7
TileablePerlinNoise.tileable_noise
4.531276
1
7
0.061470
10
7
TileableSimplexNoise.tileable_noise
8.264322
1
7
0.052569
10
7
TileableVoronoiNoise.noise2
3.651836
1
7
0.136157
10
7
TileableVoronoiNoise.noise3
11.14920
1
7
0.286601
1
7
TileableVoronoiEdges.noise2
22.70371
1
7
0.316223
1
7
TileableVoronoiEdges.noise3
110.0342
1
7
1.719043
1
7
TileableVoronoiRoundEdges.noise2
23.40995
1
7
0.356037
1
7
TileableVoronoiRoundEdges.noise3
116.0966
1
7
1.994004
1
7
TileableCellularNoise.noise2
3.537918
1
7
0.069321
10
7
TileableCellularNoise.noise3
11.11327
1
7
0.214100
1
7
TileableCellularNoise.noise24
10.93445
1
7
0.189020
10
7
TileableCellularNoise.cnoise2
11.10220
1
7
0.241810
1
7
TileableCellularNoise.cnoise3
55.26495
1
7
1.097887
1
7