Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takana671/noisetexture
Generating noise texture images.
https://github.com/takana671/noisetexture
cellular-noise cython fbm noise-textures numpy periodic-noise perlin-noise python3 voronoi
Last synced: 5 days ago
JSON representation
Generating noise texture images.
- Host: GitHub
- URL: https://github.com/takana671/noisetexture
- Owner: taKana671
- Created: 2024-10-13T03:40:53.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-11-10T04:47:26.000Z (3 months ago)
- Last Synced: 2024-11-10T05:23:42.697Z (3 months ago)
- Topics: cellular-noise, cython, fbm, noise-textures, numpy, periodic-noise, perlin-noise, python3, voronoi
- Language: Cython
- Homepage:
- Size: 75.2 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 texture and 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.# Requirements
* Cython 3.0.11
* numpy 2.1.2
* opencv-contrib-python 4.10.0.84
* opencv-python 4.10.0.84# Environment
* Python 3.11
* Windows11# Building Cython code
```
python setup.py build_ext --inplace
```# Example
```
from cynoise.perlin import Perlin
# from pynoise.perlin import Perlin
from create_image import create_image_8bit, create_image_16bitmaker = Perlin()
arr = maker.pnoise3()
create_image_8bit(arr)
create_image_16bit(arr)# change the number of lattices and the image size. The grid default is 4, size default is 256.
maker = Perlin(grid=8, size=257)```
A noise image will be output as png file.
For more details of methods and parameters, please see source codes.![sample](https://github.com/user-attachments/assets/d8c7a581-de6b-4af6-90ad-a4d095d6a854)
# Speed comparison
The execution time of each methods were measured like this.
```
maker = Voroni()
reslt = %timeit -o maker.noise2()
print(reslt.best, reslt.loops, reslt.repeat)
```
python
cython
method
best(s)
loops
repeat
best(s)
loops
repeat
Perlin.noise2
1.210008
1
7
0.017233
100
7
Perlin.noise3
2.081957
1
7
0.023179
10
7
Perlin.wrap
4.889988
1
7
0.043762
10
7
FBM.noise2
3.849672
1
7
0.041291
10
7
FBM.wrap
15.43603
1
7
0.139114
10
7
Cellular.noise2
1.420607
1
7
0.036839
10
7
Cellular.noise3
3.434327
1
7
0.090029
10
7
Cellular.noise24
4.833801
1
7
0.099891
10
7
Cellular.cnoise2
4.860955
1
7
0.153122
10
7
Cellular.cnoise3
13.82344
1
7
0.332647
1
7
Periodic.noise2
1.494618
1
7
0.021754
10
7
Periodic.noise3
2.582619
1
7
0.031351
10
7
Voronoi.noise2
1.464140
1
7
0.097766
10
7
Voronoi.noise3
3.533389
1
7
0.158923
10
7