Spaces:
Sleeping
Sleeping
| # Project Structure | |
| Mesh Palettizer - Web application for 3D model texture simplification | |
| ## Stack | |
| - Runtime: Python 3.10+ | |
| - 3D Processing: Trimesh | |
| - Image Processing: Pillow, NumPy, OpenCV | |
| - ML/Clustering: Scikit-learn | |
| - Spatial Indexing: SciPy | |
| - Web Interface: Gradio | |
| ## Commands | |
| - Web interface: `uv run python app.py` | |
| - Install: `uv sync` | |
| - Lint: `uv run ruff check .` | |
| - Format: `uv run black src/` | |
| ## Layout | |
| ``` | |
| conversion/ | |
| βββ CLAUDE.md # Global context (Tier 0) | |
| βββ app.py # Web interface with Gradio | |
| βββ README.md # Public documentation | |
| βββ pyproject.toml # Dependencies | |
| βββ context.md # Project context (Tier 2) | |
| βββ src/ # Core tool - reusable texture palettizer | |
| β βββ context.md # Module context (Tier 2) | |
| β βββ __init__.py # Main API: convert_meshes() | |
| β βββ preprocessing/ # Texture detail removal | |
| β β βββ __init__.py | |
| β β βββ simplifier.py # Bilateral filter for artifact removal | |
| β βββ extraction/ # Color extraction from meshes | |
| β β βββ __init__.py | |
| β β βββ sampler.py # Face sampling with area weighting | |
| β β βββ reader.py # Texture/material color reading | |
| β βββ palette/ # Palette generation and mapping | |
| β β βββ __init__.py | |
| β β βββ quantizer.py # K-means clustering in LAB space | |
| β β βββ mapper.py # Nearest color mapping via KD-tree | |
| β β βββ color_space.py # RGB/LAB conversion | |
| β βββ atlas/ # Texture atlas generation | |
| β β βββ __init__.py | |
| β β βββ builder.py # Atlas construction with UV mapping | |
| β βββ mesh/ # Mesh transformation | |
| β βββ __init__.py | |
| β βββ uvmapper.py # UV remapping to atlas | |
| βββ layers/ | |
| βββ structure.md # This file (Tier 1) | |
| ``` | |
| ## Architecture | |
| GLB processing with K-means color quantization and configurable palette sizes | |
| - **Pattern**: Direct transformation pipeline | |
| - **Flow**: Load meshes β Simplify textures β Sample colors β Quantize to palette β Create atlas β Apply β Export | |
| - **Palette sizes**: Powers of 2 (8Γ8=64 colors, 16Γ16=256, 32Γ32=1024, etc.) | |
| - **State**: None - pure transformation | |
| - **Optimization**: Random sampling, vectorized operations, LAB color space | |
| ## Entry Points | |
| `app.py` - Gradio web interface with configurable detail removal sensitivity | |
| `src.convert_meshes()` - Core API with palette generation and detail control |