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.

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:

  1. game_look { save: "before" } with the page showing the model.
  2. Run the command (npx @gltf-transform/cli optimize in.glb out.glb --compress meshopt, plus --texture-size 2048 when a texture is over), and point the page at out.glb. A meshopt file needs MeshoptDecoder set on the GLTFLoader (three/addons/libs/meshopt_decoder.module.js).
  3. game_look { compare: "before" }: the share of pixels that differ, and a diff picture. Keep the new file when the picture is the same.
  4. game_assets on out.glb for the new verdict.

--compress draco works too and needs DRACOLoader; KTX2 textures (--texture-compress ktx2) need the KTX-Software tools installed and KTX2Loader.