https://github.com/takana671/texturegenerator
Procedually generate texture images from noise.
https://github.com/takana671/texturegenerator
cloud cubemap cv2 cython noise noise-textures numpy python skybox
Last synced: about 1 month ago
JSON representation
Procedually generate texture images from noise.
- Host: GitHub
- URL: https://github.com/takana671/texturegenerator
- Owner: taKana671
- Created: 2025-03-19T13:02:20.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-06-07T14:21:57.000Z (8 months ago)
- Last Synced: 2025-06-07T15:26:24.557Z (8 months ago)
- Topics: cloud, cubemap, cv2, cython, noise, noise-textures, numpy, python, skybox
- Language: Python
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TextureGenerator
Procedually generate texture images from noise.
The `noise` of this repository contains two directories, `cynoise` and `pynoise`. `cynoise` has Cython source code and must be built by setup.py to use.
If it has been build, the fast Cython code is used, if not, python code is used.
See [NoiseTexture](https://github.com/taKana671/NoiseTexture/tree/main) for the difference in speed.
# 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 with submodule.
```
git clone --recursive https://github.com/taKana671/TextureGenerator.git
```
### Build cython code.
```
cd TextureGenerator
python setup.py build_ext --inplace
```
If the error like "ModuleNotFoundError: No module named ‘distutils’" occurs, install the setuptools.
```
pip install setuptools
```
# Procedural texture
Output procedural texture images from noise.
For more details of methods and parameters, please see source codes.
1. [Cloud](#cloud)
2. [Cubemap](#cubemap)
3. [Sphere map](#sphere-map)
4. [Island heightmap](#island-heightmap)
## Cloud

```
from texture_generator.cloud import Cloud
maker = Cloud.from_vfractal() # using fractal Value Noise.
# maker = Cloud.from_pfractal() # using fractal Perlin Noise.
# maker = Cloud.from_sfractal() # using fractal Simplex Noise.
# maker = Cloud.from_file('noise_5.png') # using noise image file.
# output a cloud image composited with a background image.
maker.create_cloud_image()
```
## Cubemap
The cubemap is seamless and each skybox image can be connected exactly.
See [skybox](https://github.com/taKana671/skybox).

```
from texture_generator.cubemap import CubeMap
from utils.output_image import output
maker = CubeMap.from_sfractal() # using fractal Simplex Noise.
# maker = CubeMap.from_pfractal() # using fractal Perlin Noise.
# maker = CubeMap.from_vfractal() # using fractal Value Noise.
# output a grayscale cubemap image.
img = maker.create_cubemap()
output(img, 'cubemap')
# output skybox images composited with a background image.
maker.create_skybox_images()
```
## Sphere map
### _An image for Sphere sky_
Applying this image as a texture to a sphere creates a spherical sky.

```
from texture_generator.spheremap import SphereMap
from utils.output_image import output
# using fractal Simplex Noise.
maker = SphereMap.from_sfractal()
# output a grayscale sphere map image.
img = maker.create_spheremap()
output(img, 'spheremap')
# output a sky sphere image composited with a background image.
maker.create_skysphere_image()
```
### _6 images for Sky box_
Create a sphere and use a 3D cube map to seamlessly wrap six images around its surface, creating a full-surround background.

```
from texture_generator.spheremap import SphereMap
from utils.output_image import output
# using fractal Simplex Noise.
maker = SphereMap.from_sfractal()
# output a grayscale cubemap image converted from a sphere map.
img = maker.create_cubemap()
output(img, 'cubemap')
# output skybox images composited with a background image.
maker.create_skybox_images()
```
## Island heightmap

```
from heightmap_generator.island_heightmap import IslandHeightmap
maker = IslandHeightmap.from_sfractal()
# maker = IslandHeightmap.from_sfractal(reverse=True) # basin-shaped heightmap
maker.create_island_heightmap()
```