Overview
Complete the game-dev export pipeline with interactive mesh optimization, texture management, and performance analysis tools. Essential for shipping assets to game engines.
Prerequisites
- Phase 1 (mesh buffer manipulation patterns from sub-mesh editing)
- Phase 4 (topology tools provide the mesh simplification foundation)
Scope
1. Interactive Mesh Decimation
- Slider to reduce polygon count with real-time viewport preview
- Target: triangle count, percentage, or vertex budget
- Algorithm: Quadric Error Metrics (QEM) — preserves visual quality
- Preserve UV seams and material boundaries during simplification
- Lock vertices: exclude selected vertices/edges from decimation
- Compare mode: split viewport showing original vs decimated side-by-side
- Export decimated mesh directly
2. Texture Atlas Generation
- Select multiple materials/textures → pack into a single atlas
- Configurable atlas resolution (512, 1024, 2048, 4096)
- UV remapping: automatically update mesh UVs to reference the atlas
- Channel-aware packing (don't mix normal maps with diffuse)
- Preview atlas layout before applying
- Support: diffuse, normal, specular, emissive atlases
3. Draco Mesh Compression
- Export to Draco-compressed glTF (.glb)
- Configurable compression level (1-10) and quantization bits
- Size comparison display (original vs compressed)
- Decompression preview to verify quality
4. Draw Call Analysis
- Overlay showing draw call count, material count, batch count
- Color-code objects by material (same color = same draw call potential)
- Suggestions: "Merge these 5 objects sharing MaterialX to reduce draw calls"
- One-click merge for objects sharing the same material
5. Vertex Cache Optimization
- Reorder index buffer for GPU vertex cache efficiency
- Before/after ACMR (Average Cache Miss Ratio) display
- Automatic optimization on export (optional toggle)
- Algorithm: Tom Forsyth's linear-speed vertex cache optimization
6. Memory & VRAM Usage Display
- Panel showing per-mesh: vertex count, index count, estimated GPU memory
- Per-texture: resolution, format, estimated VRAM
- Total scene budget with configurable target (e.g., "mobile: 50MB VRAM")
- Warning indicators when assets exceed budgets
- Export size estimation for each format
7. Batch Optimization Pipeline (CLI)
qtmesh optimize model.fbx -o optimized.fbx — apply all optimizations
qtmesh optimize model.fbx --target-tris 5000 — decimate to target
qtmesh atlas scene.glb -o atlased.glb --resolution 2048
qtmesh optimize model.fbx --draco -o model.glb
- JSON output for CI integration
Technical Notes
- QEM decimation: Ogre's
MeshLodGenerator uses a variant; extend or replace with a full QEM implementation that preserves UV/bone weights
- Atlas packing: Use a simple shelf/skyline bin-packing algorithm; stb_rect_pack is a lightweight option
- Draco: Link against Google's Draco library (CMake
FetchContent or bundled)
- Vertex cache opt: Implement Forsyth's algorithm (~200 lines) or use meshoptimizer library
- Memory estimation: vertex_count * stride + index_count * 2 (16-bit) or 4 (32-bit) for mesh; width * height * bpp for textures
Acceptance Criteria
Overview
Complete the game-dev export pipeline with interactive mesh optimization, texture management, and performance analysis tools. Essential for shipping assets to game engines.
Prerequisites
Scope
1. Interactive Mesh Decimation
2. Texture Atlas Generation
3. Draco Mesh Compression
4. Draw Call Analysis
5. Vertex Cache Optimization
6. Memory & VRAM Usage Display
7. Batch Optimization Pipeline (CLI)
qtmesh optimize model.fbx -o optimized.fbx— apply all optimizationsqtmesh optimize model.fbx --target-tris 5000— decimate to targetqtmesh atlas scene.glb -o atlased.glb --resolution 2048qtmesh optimize model.fbx --draco -o model.glbTechnical Notes
MeshLodGeneratoruses a variant; extend or replace with a full QEM implementation that preserves UV/bone weightsFetchContentor bundled)Acceptance Criteria
optimize,atlaswork in headless mode