Texture Generation Scripts
Blue Noise Generator
generate_blue_noise.py - Generates blue noise textures for high-quality dithering effects.
Requirements
pip install numpy pillow scipy
Usage
Basic usage (generates 128x128 texture):
python generate_blue_noise.py
Custom size:
python generate_blue_noise.py --width 256 --height 256
Custom output path:
python generate_blue_noise.py --output ../my_blue_noise.png
Advanced options:
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 methodvoid_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