Procedural Voxel Tree Generator for MagicaVoxel
Generate customizable .vox trees using palettes, sliders, and pure Python.
Built with Python, NumPy, and Pillow. The project uses a PyQt6 GUI (treegen_qt.py) which calls the shared core in worker modules.
- Five generators
- Treegen β oak-style branching tree generator
- Pinegen β pine/conifer generator with cone-shaped leaf clusters
- Birchgen β birch tree generator with slender trunks and spreading crowns
- Palmgen β tropical palm generator
- Kapokgen β broadleaf tropical tree generator (new)
- GUI
- PyQt6 UI:
treegen_qt.py(menu, About dialog, inline status, tabbed interface)
- PyQt6 UI:
- Real-time preview with multiprocessing (heavy generation in subprocesses for speed)
- Export to MagicaVoxel
.voxviaVoxExporter - Custom palettes: use 256-color PNG palettes placed in
palettes/tree/,palettes/pine/,palettes/birch/,palettes/palm/,palettes/kapok/(internal palm and kapok palettes added) - Randomize presets and deterministic generation via seed
- Organized output folders:
output/tree/,output/pine/,output/birch/,output/palm/,output/kapok/ - "Open file after generation" option (platform-aware)
- Non-modal export status displayed above each preview in the PyQt UI
- Unique filenames using timestamps to avoid overwrites
-
Kapokgen β broadleaf tropical tree generator with roots, canopy, and leaves
- Kapok palette combo popup uses themed styling consistent with other tabs.
- Kapok seed control uses the themed slider wired to preview, export, and randomize.
-
New internal kapok palettes (programmatically registered)
Kapok Tropical(existing)Kapok Lushβ denser, deeper greens + bright upper canopy highlightsKapok Duskβ warm highlights, yellow/orange top canopy and darker trunk for sunset scenesKapok Rainforestβ deep emerald greens with golden trunk flecks for a dense jungleKapok Exoticβ electric pinks and purples for a surreal, bioluminescent paradiseKapok Neonβ glowing blues and cyans like a cyber-tropical forestKapok Mysticβ enchanted purples and golds for a magical groveKapok Auroraβ shimmering greens and blues like northern lights over a tropical treeKapok Infernoβ blazing reds and oranges for a volcanic tropical infernoKapok Crystalβ icy blues and whites for a frozen crystalline wonder These are provided viapalette_worker.pyso no external PNG files are required to use them.
-
Palmgen UI polish
- Palm palette combo popup now uses the themed styling consistent with other tabs (Tree/Pine/Birch/Kapok).
- Palm seed control was changed from a spinbox to the themed slider used across the app; the slider value is wired to preview, export and randomize.
-
New internal palm palettes (programmatically registered)
Palm Default(existing)Palm Lushβ deep saturated tropical greens with darker trunkPalm Duskβ cool bluish fronds for low-light scenesPalm Sandbarβ pale yellow-greens and sandy trunk for beachy palmsPalm Sunsetβ warm orange-tinged fronds with rich trunk tones These are provided viapalette_worker.pyso no external PNG files are required to use them.
-
Frond colour mapping
- Leaf voxels are now mapped to palette indices based on their fractional position along each frond (t01) so frond mid-lengths read darker and tips read lighter. This produces a natural dark band down the centre of fronds and a smooth outward-lightening gradient.
-
Complete birchgen rework:
- birch generator now builds tress in a new, more natural way
- low trunk thickness and leaf bundles at the end o branches are the main implementations
Treegen sliders/controls and ranges:
Size: 0.1 β 3.0Trunk Size: 0.1 β 1.2Spread: 0.0 β 1.0Twist(twisted): 0.0 β 1.0Leafiness: 0.0 β 3.0Gravity: -1.0 β 1.0Wide: 0.0 β 1.0Iterations: 5 β 15 (integer)Seed: 1 β 9999
Pinegen sliders/controls and ranges:
Size: 0.1 β 3.0Twist(twisted): 0.0 β 4.0Trunk Size: 1.0 β 3.0Trunk Height: 0.0 β 5.0Branch Density: 0.0 β 3.0Branch Length: 0.0 β 3.0Branch Direction: -5.0 β 5.0Leafiness: 0.0 β 2.0Leaf Radius: 1.0 β 4.0Leaf Stretch: 0.5 β 3.0Leaf Bias: -1.0 β 1.0Seed: 1 β 9999
Birchgen sliders/controls and ranges:
Size: 0.1 β 3.0Trunk Size: 0.05 β 0.8Spread: 0.1 β 0.8Twist(twisted): 0.0 β 1.0Leafiness: 0.0 β 3.0Gravity: -1.0 β 1.0Wide: 0.05 β 0.2Iterations: 5 β 14 (integer)Seed: 1 β 9999
Palmgen sliders/controls and ranges:
Size: 0.1 β 3.0Trunk Height: 0.0 β 340.0Trunk Width: 0.3 β 4.0Trunk Iter: 12 β 80 (integer)Bend: 0.0 β 1.0Frond Count: 4 β 72Frond Length: 0.1 β 3.0Frond Var: 0.0 β 1.0Frond Random: 0.0 β 1.0Gravity: 0.0 β 1.0Frond Width: 0.1 β 1.0Seed: 1 β 9999
Kapokgen sliders/controls and ranges (new):
Size: 0.1 β 3.0Trunk Extend: 0.0 β 340.0Trunk Size: 0.3 β 4.0Trunk Iter: 8 β 40 (integer)Bend: 0.0 β 1.0Root Twist: 0.0 β 1.0Root Profile: 0.0 β 1.0Root Spread: 0.0 β 1.0Root Count: 0 β 8 (integer)Root Variance: 0.0 β 1.0Canopy Iter: 5 β 15 (integer)Wide: 0.0 β 1.0Spread: 0.0 β 1.0Canopy Twist: 0.0 β 1.0Leaves: 0.0 β 3.0Gravity: -1.0 β 1.0Canopy Thick: 0.0 β 1.0Canopy Profile: 0.0 β 1.0Canopy Flat: 0.0 β 1.0Canopy Start: 0.0 β 1.0Seed: 1 β 9999
Other UI features (PyQt6 port)
- Menu bar: File β Close, Help β About (About shows app/version/credits)
- Inline status: export results appear above the preview (
tree_dim_label/pine_dim_label/birch_dim_label/palm_dim_label/kapok_dim_label) - Preview uses worker modules and runs in a worker QThread with progress signals and cooperative cancellation
- Export runs in a separate process (ProcessPoolExecutor) and writes
.voxfiles usingVoxExporter - Tabbed interface for easy switching between generators
- Previews update on startup, tab changes, and palette selections
treegen_qt.pyβ PyQt6 GUI (primary frontend)treegen_worker.pyβ Treegen generation logic and VoxExporterpinegen_worker.pyβ Pinegen generation logic and VoxExporterbirch_worker.pyβ Birchgen generation logic and VoxExporterpalm_worker.pyβ Palm generator and export logickapok_worker.pyβ Kapok generator and export logic (new)palette_worker.pyβ Palette management utilities (internal palm and kapok palettes added)palettes/β palette PNGs for tree, pine, birch, palm, and kapok (optional when internal palettes are used)output/tree/,output/pine/,output/birch/,output/palm/,output/kapok/β generated .vox files
Minimum Python packages:
- Python 3.8+
- numpy
- pillow
- PyQt6
Install with pip:
pip install numpy pillow PyQt6PyQt6 UI (primary):
python treegen_qt.pyThe PyQt UI calls into the worker modules. Use the preview to iterate before exporting .vox files.
Each palette is expected to be a 256-entry PNG (one-row palette). Place palettes in:
palettes/tree/palettes/pine/palettes/birch/palettes/palm/palettes/kapok/
Palm and kapok palettes are also provided programmatically inside palette_worker.py and do not require external PNG files. Use the Palm and Kapok-themed palettes via the respective tab combos.
- Exports produce
.voxfiles compatible with MagicaVoxel and are saved tooutput/tree/,output/pine/,output/birch/,output/palm/, oroutput/kapok/. - Filenames use timestamps (e.g.,
kapok_20231005_143022.vox) to ensure uniqueness without external counter files.
Made by NGNT Creations
MIT β Free to use and modify.




