neversight/learn-skills.dev/glb-web-export
Claude Code and agent skill by neversight/learn-skills.dev
- community
Checking that the SKILL.md file is still in the repository.
Audit a .glb or .gltf and make it small, correct, and fast to load in a browser, with a measured before/after report. Use when a model is "too big" or "slow to load", when the user asks to "optimize this GLB", "compress this glTF", or "export for web", or when they mention Draco, meshopt, gltfpack, KTX2, Basis, texture VRAM, draw calls, or a Blender / CAD / photogrammetry / Pascal export headed for Three.js, React Three Fiber (drei useGLTF), Babylon.js, or model-viewer. Covers inspection, spec validation, geometry and texture compression, scene-graph cleanup, and the correctness checks (metres, Y-up, node names, animations, PBR fidelity, alpha modes, vertex colors) that must not regress. Not for editing or modelling geometry, authoring or laying out a scene, generating 3D from text or images, converting from FBX/OBJ/CAD, or debugging a runtime frame rate that has nothing to do with asset size.
Install
npx vskill@latest install neversight/learn-skills.dev/glb-web-exportSKILL.md
The same SKILL.md was published earlier as neversight/learn-skills.dev/glb-web-export.
GLB Web Export
Take a .glb/.gltf that came out of Blender, a CAD tool, a photogrammetry pipeline, or a Pascal export, and turn it into an asset a browser can download and render quickly — without silently breaking the things the app depends on.
The deliverable is not a smaller file. It is a smaller file plus a report that proves nothing regressed.
When to Use
- A
.glb/.gltfis too big, slow to load, or blows up GPU memory - Preparing an asset for Three.js, R3F/drei, Babylon.js, or
<model-viewer> - Choosing between Draco, meshopt, and no geometry compression
- Choosing between KTX2/Basis, WebP, and resized PNG/JPEG for textures
- Auditing an asset before shipping it, or diagnosing why it loads slowly
When NOT to Use
- Editing or modelling geometry, or laying out/authoring a scene
- Generating a 3D model from text, an image, or a floor plan
- Converting from FBX/OBJ/STEP (do the conversion first, then use this skill)
- Runtime frame-rate problems unrelated to asset size (shaders, physics, effects)
Workflow
Never skip step 1. An optimization with no measured before is a guess.
1. Measure
Keep the original. Every command below writes a new file; never optimize in place.
Check the tool versions rather than assuming (package names and versions move):
Inspect, then validate against the spec:
inspect gives resolution and gpuSize per texture, per-mesh vertex/triangle counts, and the extension list. validate runs the Khronos validator (the gltf-validator npm package is a library with no CLI — npx gltf-validator fails with "could not determine executable to run"; gltf-transform validate wraps it, verified with @gltf-transform/cli@4.5.0 bundling gltf-validator@2.0.0-dev.3.10).
Then capture the numbers you will be judged on:
It reports raw/gzip/brotli bytes, texture VRAM, draw calls, triangles, world-space bounds in metres, named nodes, and required extensions. Pass a second path after optimizing to get a delta plus an automatic regression list.
Read inspect to answer: is this texture-heavy (large size/gpuSize), geometry-heavy (high vertex counts, f32 attributes), draw-call-heavy (many mesh primitives), or just dirty (unused materials, duplicate textures)? The answer decides step 2.
2. Decide
Geometry compression — pick exactly one
| Situation | Choice | |
|---|---|---|
Target loader can be given a decoder (Three.js setMeshoptDecoder, Babylon 5+, <model-viewer> with meshoptDecoderLocation set) | meshopt — EXT_meshopt_compression, fastest decode, compresses geometry and animation | |
| Draco decoder is already wired, or the consumer is Draco-only | Draco — KHR_draco_mesh_compression, geometry only | |
| You cannot confirm what will load the file | Neither. Use quantize only (KHR_mesh_quantization) or plain float geometry |
How to check the loader before choosing — do not guess:
- Three.js — grep the app for
setMeshoptDecoder/setDRACOLoader. Absent means the extension will fail to load. - R3F/drei —
useGLTFenables Draco and meshopt by default; KTX2 needsextendLoader. - `<model-viewer>` — Draco and KTX2 decoders load from a CDN by default; meshopt is not enabled by default.
- Babylon.js — Draco, meshopt, and KTX2 are built in and fetch decoders from the Babylon CDN.
Exact API names, defaults and doc URLs: references/loader-support.md.
Textures — usually the biggest win
Resize first. Halving each dimension quarters both bytes and VRAM, and no codec recovers a 4× texel reduction.
| Situation | Choice | |
|---|---|---|
Loader supports KHR_texture_basisu and VRAM matters | KTX2 — etc1s (small) or uastc (normal maps, high quality). Stays block-compressed on the GPU | |
| Loader has no KTX2 support, or you want minimal setup | WebP (EXT_texture_webp) or a resized PNG/JPEG. Decodes to RGBA8 in VRAM |
KTX2 wins on VRAM by roughly 6–8× over WebP at the same resolution, because PNG/JPEG/WebP/AVIF are fully decompressed in GPU memory while ETC1S/UASTC are not. On the fixture: 5.33 MiB VRAM (WebP) vs 0.67 MiB (ETC1S), same 1024px source.
Structural passes
Cheap, lossless, run these first: dedup (duplicate accessors/textures/ materials/meshes), prune (unreferenced properties), weld (merge bitwise identical vertices, producing an index buffer), quantize (f32 → i8/i16).
Structure-changing, opt in deliberately: instance (shared meshes → EXT_mesh_gpu_instancing, cuts draw calls, erases the per-node names), flatten (collapse the hierarchy), join (merge primitives — can increase size when meshes are reused; verified on the fixture: 12,882,440 → 12,890,228 B).
3. Apply
Two pipelines. Start with the first.
Name-preserving (default)
Keeps the scene graph and every node name an app might look up.
Draw-call reduction (opt in)
Add before the compression step, only if the app does not resolve nodes by name:
One-liner
optimize bundles the above but its defaults are aggressive — it runs simplify, palette, flatten and join. On the fixture it dropped 15 of 16 named nodes and changed the triangle count (7,056 → 6,740). Use it only when the asset is a static prop with no app-visible structure:
gltfpack is a good alternative and does geometry + textures in one pass. Use -kn -km to keep named nodes and materials. Flags: references/commands.md.
4. Verify
Re-run the audit against the original and check the regression list is empty:
Then confirm each item in references/correctness-checklist.md. The non-negotiables:
- Units and scale. glTF units are metres and +Y is up (spec §Coordinate System and Units, fetched 2026-09-11). The audit's
worldBounds.sizeMetersmust be unchanged. Do not readinspect'sbboxMin/bboxMaxfor this — afterquantize/meshopt/dracoit reports accessor-local bounds, and the fixture's harmless output shows-1,-1,-1 → 1,1,1while the real world size is still4.4 × 1 × 3.2 m. - Node names and hierarchy.
namedNodesLostmust be empty, or every entry must be one the app provably does not use. - Animations and skins. Counts must not drop.
join/flattenwill not move animated nodes, butpruneremoves animations that target nothing in a scene. - Materials. Same count of distinct appearances, same
alphaModeper material,KHR_materials_*extensions still listed, vertex colors (COLOR_0) still present. - Loader can decode it. Every entry in
extensionsRequiredmust be supported by the target loader, with its decoder wired up. Load the output in the real app before shipping.
5. Report
Report the measurement, not the effort. Template:
State "not measured" for load time unless you actually measured it. Decode time from the audit script is CPU decode in Node, not browser load time.
Stop rules
- Never ship a file the target loader cannot decode. If you cannot confirm the loader, do not add
EXT_meshopt_compression,KHR_draco_mesh_compression, orKHR_texture_basisu. - Never optimize without a measured before. No baseline, no claim.
- Never delete or overwrite the original. Every step writes a new file.
- Never report a size win while hiding a correctness loss. If names, animations, or scale changed, say so in the same table.
- If the output is not smaller, stop and say so.
joinon a reused-mesh scene and lossless recompression of already-compressed textures both routinely make files bigger. - Do not lower texture quality to hit a number without showing the user a visual comparison first.
Troubleshooting
`Command failed: command -v ktx` — etc1s/uastc shell out to KTX-Software. Install it and put ktx on PATH (@gltf-transform/cli@4.5.0 probes for ktx, not the older toktx). Or use webp instead.
`gltfpack was built without BasisU/WebP support` — the npm gltfpack@1.2.0 build has no texture encoders. Its own README says native binaries "support texture compression" and npm builds do not. Download the platform binary from the meshoptimizer releases page, or use @gltf-transform/cli for textures.
`Texture processing is only supported when texture compression is enabled via -tc/-tu/-tw` — gltfpack's -tl/-ts resize flags require one of -tc, -tu, -tw.
Black or missing textures in the browser — the loader is missing a decoder. Check extensionsRequired against references/loader-support.md.
`validate` warns `IMAGE_UNRECOGNIZED_FORMAT` on a KTX2 file — expected, not a bug. The bundled gltf-validator@2.0.0-dev.3.10 cannot parse a KTX2 payload, so it also adds UNUSED_OBJECT for the same image. Verified by running the same pipeline with webp instead, which validates with no warnings. Do not "fix" it.
Draco output is bigger than meshopt after brotli — expected. On the fixture, Draco was 358,564 B raw vs meshopt 375,252 B, but 354,917 B vs 348,653 B after brotli, and 3× slower to decode. Compare transfer sizes, not raw ones.
Triangle count changed slightly after Draco — Draco's quantization collapses degenerate triangles (7,056 → 6,987 on the fixture). Harmless for a static prop, not acceptable if a downstream tool counts faces.
References
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdata/skills-md/pascalorg/skills/glb-web-export/SKILL.md
Popularity
- Repository stars
- 218
- Repository forks
- 38
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/neversight/learn-skills.dev/glb-web-export)