63 lines
1.8 KiB
Markdown
63 lines
1.8 KiB
Markdown
# Texture Generation Scripts
|
|
|
|
## Blue Noise Generator
|
|
|
|
`generate_blue_noise.py` - Generates blue noise textures for high-quality dithering effects.
|
|
|
|
### Requirements
|
|
|
|
```bash
|
|
pip install numpy pillow scipy
|
|
```
|
|
|
|
### Usage
|
|
|
|
Basic usage (generates 128x128 texture):
|
|
```bash
|
|
python generate_blue_noise.py
|
|
```
|
|
|
|
Custom size:
|
|
```bash
|
|
python generate_blue_noise.py --width 256 --height 256
|
|
```
|
|
|
|
Custom output path:
|
|
```bash
|
|
python generate_blue_noise.py --output ../my_blue_noise.png
|
|
```
|
|
|
|
Advanced options:
|
|
```bash
|
|
python generate_blue_noise.py --width 128 --height 128 --sigma 1.5 --method void_cluster
|
|
```
|
|
|
|
### Parameters
|
|
|
|
- `--width`: Texture width in pixels (default: 128)
|
|
- `--height`: Texture height in pixels (default: 128)
|
|
- `--method`: Generation method
|
|
- `void_cluster`: High-quality void-and-cluster method (default, recommended)
|
|
- `annealing`: Simulated annealing method (slower)
|
|
- `--sigma`: Gaussian kernel sigma for void_cluster method (default: 1.5)
|
|
- Lower values (0.8-1.2): Tighter clustering, more high-frequency
|
|
- Higher values (2.0-3.0): Smoother distribution
|
|
- `--iterations`: Number of iterations (optional, auto-calculated if not specified)
|
|
- `--output`: Output file path (default: ../blue_noise.png)
|
|
|
|
### What is Blue Noise?
|
|
|
|
Blue noise is a type of noise with energy concentrated in high frequencies and minimal low-frequency content. This makes it ideal for dithering because:
|
|
|
|
- No visible patterns or clustering
|
|
- Smooth gradients without banding
|
|
- Perceptually pleasing distribution
|
|
- Better than Bayer or white noise for transparency effects
|
|
|
|
### Use Cases in snow_trail_sdl
|
|
|
|
- **Tree dissolve effect**: Dither trees between camera and player for unobstructed view
|
|
- **Temporal effects**: Screen-space dithering for transitions
|
|
- **Transparency**: High-quality alpha dithering
|
|
- **LOD transitions**: Smooth fade between detail levels
|