PixelTree 🌳
A high-performance procedural 2D tree generator for pixel-art games, built with Bevy. Generate beautiful, wind-animated trees with automatic LOD and spatial culling.
Features
Performance First
- Zero-cost abstractions with minimal dependencies
- Parallel generation using Rayon for forests
- Spatial indexing for efficient culling of off-screen trees
- Pre-computed wind tables eliminate per-frame trigonometry
- Memory-optimized leaf data structures with ~40% less memory usage
Procedural Generation
- Deterministic generation - same position always yields same tree
- Customizable parameters - height, width, branching, leaf density
- Multiple tree templates - Default, Pine, Oak, Willow
- Stack-based branch generation - no recursion overhead
Game-Ready
- Automatic LOD system with 4 detail levels
- Wind animation with customizable strength and turbulence
- GPU instancing support for rendering thousands of trees
- Compact serialization for save files and networking
Quick Start
use *;
use *;
Advanced Usage
Generate a Forest
// Generate 100 trees in parallel
let positions: =
.map
.collect;
spawn_forest;
Deterministic Generation
// Trees at the same position will always look identical
let tree = generate_tree_deterministic;
Custom Tree Templates
let params = GenerationParams ;
Query Visible Trees
Cargo Dependencies
[]
= "0.16.1"
= "0.8"
= { = "1.0", = ["derive"] }
= "1.7"
License
MIT License - see LICENSE for details.