$npx -y skills add rawwerks/VibeCAD --skill gltf-transformOptimize and post-process GLB/glTF 3D models. Use when compressing models for web delivery, reducing file size, simplifying geometry, inspecting model stats, merging models, or converting textures. Triggers on: optimize GLB, compress model, reduce file size, simplify mesh, draco
| 1 | # glTF Transform |
| 2 | |
| 3 | Post-process GLB/glTF files: optimize, compress, inspect, and transform 3D models. |
| 4 | |
| 5 | - CLI docs: https://gltf-transform.dev/cli |
| 6 | - GitHub: https://github.com/donmccurdy/glTF-Transform |
| 7 | - npm: `@gltf-transform/cli` |
| 8 | |
| 9 | ## Zero-Setup with bunx |
| 10 | |
| 11 | No installation required. Run any command with: |
| 12 | |
| 13 | ```bash |
| 14 | bunx @gltf-transform/cli <command> [args] |
| 15 | ``` |
| 16 | |
| 17 | First run downloads the tool, subsequent runs are instant. |
| 18 | |
| 19 | ## Quick Start |
| 20 | |
| 21 | ```bash |
| 22 | # Inspect model stats first |
| 23 | bunx @gltf-transform/cli inspect model.glb |
| 24 | |
| 25 | # One-command optimization (good defaults) |
| 26 | bunx @gltf-transform/cli optimize input.glb output.glb --compress draco --texture-compress webp |
| 27 | ``` |
| 28 | |
| 29 | ## CAD Workflow Integration |
| 30 | |
| 31 | Typical pipeline after generating models with build123d: |
| 32 | |
| 33 | ``` |
| 34 | create geometry → export GLB → optimize → verify visually |
| 35 | ``` |
| 36 | |
| 37 | 1. **build123d** exports high-quality CAD geometry |
| 38 | 2. **gltf-transform** compresses for web delivery |
| 39 | 3. **render-glb** verifies the result |
| 40 | |
| 41 | ## Compression Methods |
| 42 | |
| 43 | | Method | Best For | Trade-offs | |
| 44 | |--------|----------|------------| |
| 45 | | **Draco** | Web delivery, Three.js | Smallest geometry, requires decoder | |
| 46 | | **Meshopt** | Universal, animations | Good compression + animation support | |
| 47 | | **Quantize** | Compatibility | No decoder needed, moderate compression | |
| 48 | |
| 49 | ```bash |
| 50 | # Draco - best geometry compression |
| 51 | bunx @gltf-transform/cli draco input.glb output.glb |
| 52 | |
| 53 | # Meshopt - geometry + animation compression |
| 54 | bunx @gltf-transform/cli meshopt input.glb output.glb |
| 55 | |
| 56 | # Quantize only - no external decoder needed |
| 57 | bunx @gltf-transform/cli quantize input.glb output.glb |
| 58 | ``` |
| 59 | |
| 60 | ## Texture Compression |
| 61 | |
| 62 | ```bash |
| 63 | # WebP - good compression, wide browser support |
| 64 | bunx @gltf-transform/cli webp input.glb output.glb |
| 65 | |
| 66 | # Resize large textures |
| 67 | bunx @gltf-transform/cli resize input.glb output.glb --width 1024 --height 1024 |
| 68 | ``` |
| 69 | |
| 70 | ## Common Operations |
| 71 | |
| 72 | ### Inspect Model Stats |
| 73 | ```bash |
| 74 | bunx @gltf-transform/cli inspect model.glb |
| 75 | ``` |
| 76 | |
| 77 | Shows vertex count, file size breakdown, texture sizes - helps decide what to optimize. |
| 78 | |
| 79 | ### Simplify Geometry |
| 80 | ```bash |
| 81 | # Weld duplicate vertices first |
| 82 | bunx @gltf-transform/cli weld input.glb temp.glb |
| 83 | |
| 84 | # Then simplify |
| 85 | bunx @gltf-transform/cli simplify temp.glb output.glb --ratio 0.5 |
| 86 | ``` |
| 87 | |
| 88 | Useful for CAD models which often have more detail than needed for web viewing. |
| 89 | |
| 90 | ### Merge Multiple Models |
| 91 | ```bash |
| 92 | bunx @gltf-transform/cli merge part1.glb part2.glb assembly.glb |
| 93 | ``` |
| 94 | |
| 95 | ### Aggressive Optimization |
| 96 | ```bash |
| 97 | bunx @gltf-transform/cli optimize input.glb output.glb \ |
| 98 | --compress draco \ |
| 99 | --texture-compress webp \ |
| 100 | --simplify true \ |
| 101 | --simplify-ratio 0.5 |
| 102 | ``` |
| 103 | |
| 104 | ## When to Use |
| 105 | |
| 106 | | Scenario | Commands | |
| 107 | |----------|----------| |
| 108 | | Web delivery | `optimize --compress draco --texture-compress webp` | |
| 109 | | Check model stats | `inspect` | |
| 110 | | High-poly CAD model | `weld` then `simplify --ratio 0.5` | |
| 111 | | Combine parts | `merge` | |
| 112 | | Debug issues | `inspect` then targeted fixes | |