A professional, modular system for generating procedural 3D designs using reaction-diffusion and space colonisation algorithms.
- Gray-Scott Reaction-Diffusion: Generate organic patterns for vases and vessels
- Space Colonisation: Create perforated structures with branch-like patterns
- CPU/GPU Support: Taichi-powered GPU acceleration for fast simulations
- Multiple Interfaces: Jupyter notebooks, CLI tools, and interactive Streamlit app
- Production Ready: Comprehensive tests, type hints, and documentation
- 3D Print Optimised: Mesh validation and export to STL/OBJ/PLY formats
cd procedural-design
pip install -r requirements.txtPython:
from pipelines.vase import VasePipeline, VaseConfig
config = VaseConfig(pattern_type='spots')
pipeline = VasePipeline(config)
mesh = pipeline.generate()
pipeline.export('vase.stl')CLI:
python src/cli/generate_vase.py \
--pattern spots \
--output vase.stl \
--statsInteractive:
streamlit run src/app/streamlit_app.pySee docs/QUICK_START.md for more examples.
procedural-design/
├── src/
│ ├── algorithms/ # Core generative algorithms
│ │ ├── gray_scott.py # Reaction-diffusion (CPU/GPU)
│ │ └── space_colonization.py # Branch growth
│ ├── geometry/ # Mesh operations
│ │ ├── primitives.py # Basic shapes
│ │ ├── mesh_operations.py # Processing & validation
│ │ └── tube_sweep.py # Tube generation
│ ├── pipelines/ # End-to-end workflows
│ │ ├── vase.py # Vase generation
│ │ └── moss_pole.py # Perforated structures
│ ├── cli/ # Command-line tools
│ └── app/ # Streamlit web app
├── tests/ # Comprehensive test suite
├── notebooks/ # Jupyter notebooks
│ ├── 01_refactored_example.ipynb
│ └── experiments/
└── docs/ # Documentation
├── QUICK_START.md
└── REFACTORING_GUIDE.md
# notebooks/experiments/my_experiment.ipynb
from pipelines.vase import VasePipeline, VaseConfig
# Iterate through patterns
for pattern in ['spots', 'stripes', 'waves']:
config = VaseConfig(pattern_type=pattern)
pipeline = VasePipeline(config)
mesh = pipeline.generate()
pipeline.export(f'vase_{pattern}.stl')# Generate 10 variants with different seeds
for seed in {1..10}; do
python src/cli/generate_vase.py \
--random-seed $seed \
--output "vase_$seed.stl"
donefrom pipelines.moss_pole import MossPolePipeline, MossPoleConfig
# Generate multiple pole heights
for height in [150, 200, 250]:
config = MossPoleConfig(height=height)
pipeline = MossPolePipeline(config)
mesh = pipeline.generate()
pipeline.export(f'pole_{height}mm.stl')streamlit run src/app/streamlit_app.pyProvides real-time parameter adjustment with instant preview.
Run comprehensive test suite:
# All tests
pytest tests/ -v
# Specific tests
pytest tests/test_gray_scott.py -v
# With coverage
pytest tests/ --cov=src --cov-report=htmlTests include:
- Algorithm correctness
- CPU/GPU consistency (Taichi)
- Mesh validation
- Pipeline integration
- Edge cases and performance
- NumPy/SciPy: Numerical computing
- Taichi: GPU acceleration
- Trimesh: 3D mesh operations
- scikit-image: Marching cubes
- Matplotlib: Visualisation
- Streamlit: Interactive web app
- pytest: Testing framework
- QUICK_START.md - Get started in 5 minutes
- REFACTORING_GUIDE.md - Detailed architecture guide
.cursor/rules/- Coding standards and guidelines- Docstrings - Inline documentation in all modules
Simulates chemical reactions that produce organic patterns. Parameters:
- Pattern presets: spots, stripes, waves, holes
- Feed rate (F): 0.01-0.08
- Kill rate (k): 0.045-0.065
- Resolution: 64-512
- Steps: 1000-20000
Grows branch-like structures toward attractor points. Parameters:
- Attractor count: 500-5000
- Influence radius: 5-30 mm
- Kill radius: 1-10 mm
- Step size: 0.5-5 mm
- Create algorithm in
src/algorithms/ - Add config dataclass
- Write comprehensive tests
- Create pipeline in
src/pipelines/ - Add CLI tool and Streamlit interface
See REFACTORING_GUIDE.md for details.
- Type hints throughout
- Comprehensive docstrings
- Australian English spelling
- Pytest test coverage
- Follows
.cursor/rules/standards
- CPU: NumPy vectorised operations
- GPU: Taichi JIT compilation (10-100x speedup)
- Memory: Efficient field representations
- Batch: CLI tools for parallel processing
- Fork the repository
- Create a feature branch
- Add tests for new features
- Follow coding standards in
.cursor/rules/ - Submit a pull request
MIT License
- Gray-Scott Model: P. Gray & S. K. Scott (1983)
- Space Colonisation: Runions et al. (2005)
- Trimesh: Michael Dawson-Haggerty
- Taichi: Taichi Graphics
- Documentation: See
docs/directory - Examples: Check
notebooks/andtests/ - Issues: Open a GitHub issue
- Questions: See QUICK_START.md and REFACTORING_GUIDE.md