Skip to content
← all lab notes

The 59 KB car that lost its parts

Our GLB optimizer hit the size target and broke the semantic interface. The failure only appeared when we tested the artifact itself.

3D pipelinetestingglTF

The car model had a job beyond looking like a car. A diagnosis such as P0420 needed to highlight the catalytic converter and exhaust path; an ABS code needed addressable wheels; an engine-cooling result needed a radiator. That made the names inside the GLB an interface between diagnostic logic and the renderer.

The first optimized build looked successful. It was small, valid, and rendered correctly. It had also destroyed that interface.

The contract came before the model

The diagnostic catalog already grouped codes into systems such as Emissions, Engine Cooling, Transmission, and Chassis and ABS. We defined a mapping from each system to semantic mesh names including part_exhaust_cat, part_radiator, part_gearbox, and four separate wheel names.

The sourced Kenney sedan supplied the body and wheels. A reproducible Blender script then reoriented and rescaled it, renamed the sourced meshes, and authored twelve diagnostic components the kit did not contain. Those components were positioned from the imported geometry—axle positions, wheel radius, and body bounds—instead of a pile of coordinates tuned by hand.

That gave us sixteen diagnostic targets and a simple promise: every name in the TypeScript contract must exist in the built model.

The optimization that passed every visual check

The raw export was about 189 KB. We ran it through gltf-transform optimize with meshopt compression and reached 59.77 KB, comfortably below the 300 KB budget.

The default optimizer also performs join and instance steps. Those are sensible for many assets: fewer meshes can mean fewer draw calls. In our case, distinct names carried product meaning. The optimizer saw geometry it could combine and silently collapsed sixteen named diagnostic meshes into two.

Nothing looked obviously broken in a normal exterior render. The file loaded. The silhouette was intact. The size graph was excellent. Only the future interaction—asking the renderer for part_exhaust_cat—had stopped working.

Test the built artifact, not the source intention

The fix was to run optimization with --join false --instance false. Deduplication remains enabled because sharing identical vertex-buffer data does not require discarding node and mesh identity.

The durable fix was an integrity test. It reads the committed binary GLB directly, checks the header, locates its JSON chunk, and collects every node and mesh name. The test then asserts that every member of ALL_PART_MESHES is present.

No rendering library is needed for that check. Node’s Buffer and DataView are enough to inspect the artifact that actually ships.

The same suite checks the other side of the interface:

  • every system in the DTC catalog has a system-to-parts mapping;
  • every mapped value belongs to the declared mesh contract;
  • every declared contract name exists inside the built GLB;
  • overrides reference real diagnostic codes rather than stale identifiers.

The chain is catalog → mapping → contract → binary. A break at any boundary goes red.

What the size number could not tell us

Performance budgets are useful, but they verify only one dimension of an asset. A 59 KB car can still be a failed product artifact.

The more general lesson is that an asset pipeline is a compiler. Mesh names, material slots, coordinate conventions, collision layers, and animation tracks can all be public interfaces. Optimization passes should be treated like compiler transformations: define the invariants they must preserve, then test the output rather than assuming the flags respected the source author’s intent.

Our current output is a 59.77 KB meshopt-compressed GLB with all sixteen semantic diagnostic parts intact. The exact visual can change later. The contract cannot disappear quietly again.

The remaining boundary

This test proves the required names exist. It does not prove that every authored part is placed correctly or visually legible. Those failures required body-hidden renders, isolated close-ups, and coordinate contact checks during the Blender review. Artifact integrity and visual review cover different failure modes; neither replaces the other.