Model files: game_assets and gltf-transform
game_assets reports what a website or a Shopify listing judges a .glb or .gltf on, for one file (path) or every one under a folder (the whole project when path is left out). It reads the file's JSON and its images' headers only, so a Draco or meshopt file needs no decoder:
models/chair.glb · 6.1 MB · 48,210 triangles · 3 materials · textures: 4096×4096 png, 1024×1024 jpeg · Draco no, meshopt no, KTX2 no
shopify: fails, 6.1 MB over about 4 MB; 4096×4096 texture over 2048
Fix: npx @gltf-transform/cli optimize models/chair.glb models/chair-opt.glb --compress meshopt --texture-size 2048, then game_look compare against a look saved before (save) and game_assets on models/chair-opt.glb.
- Triangles come from the accessor counts in the JSON: indices (or positions) / 3 for triangle lists, count - 2 for strips and fans, none for points and lines (counted apart). Each mesh counts once per node that uses it in the default scene.
- A texture's size is read from its PNG, JPEG, WebP or KTX2 header;
?means a format or a place it cannot read. target: "site"(the default) judges against thesitebudget ofgame_perf: 4 MB of assets, 200,000 triangles, textures of 2048 px by area (a 4096 × 1 lookup table passes). One file over 4 MB already fills a whole site's budget.target: "shopify"judges against Shopify's 3D model guidance: a GLB of about 4 MB, textures at most 2048 px on their longest side, no triangle limit.
Fixing a file: the gltf-transform pairing
The harness does not rewrite model files. A failing file's reply ends with the gltf-transform command that fixes it; check the result with the harness:
game_look { save: "before" }with the page showing the model.- Run the command (
npx @gltf-transform/cli optimize in.glb out.glb --compress meshopt, plus--texture-size 2048when a texture is over), and point the page atout.glb. A meshopt file needsMeshoptDecoderset on theGLTFLoader(three/addons/libs/meshopt_decoder.module.js). game_look { compare: "before" }: the share of pixels that differ, and a diff picture. Keep the new file when the picture is the same.game_assetsonout.glbfor the new verdict.
--compress draco works too and needs DRACOLoader; KTX2 textures (--texture-compress ktx2) need the KTX-Software tools installed and KTX2Loader.