master
John Lauer Publish 0.8.11 81c0a90 1mo ago

Generation and cache contract

  1. Resolve the exact component wiki record and its current reviewed GLB/thumbnail manifest. Verify content hashes. Record the manufacturer STEP hash, reviewed GLB hash, artwork cache key, MPN, marking placement, coordinate transform, generator version and options. Reuse matching cached output before regenerating it. A changed marking pose invalidates all affected derivatives, including symbol chip outlines.
  2. Preserve the original source files. Generate under the same component repo, for example lod/high.glb, lod/medium.glb, lod/low.glb, lod/super-low.glb, with one manifest. Do not rewrite another author's preexisting component pages if the user excluded them.
  3. Count primitives and decoded data before optimizing. A GLB with 79 mesh definitions can contain almost 12,000 primitives and create a corresponding number of Babylon render meshes. Small archive size is not evidence of cheap rendering. Batch only compatible triangle primitives/materials; preserve part identities, transforms, optical features, signal-label semantics and animation joints. Compare indexed positions/normals and material assignment before/after lossless batching. Handle normalized/quantized accessors correctly.
  4. Generate lower levels with an error-bounded simplifier and measured output counts. Ratios are targets, not results: topology and error limits may prevent reduction. Weld compatible split vertices first when needed. Do not aggressively simplify text outlines, pin-1 indicators or optical interfaces without a specific visual review. Preserve their high-detail sources and restore full fidelity before they become readable on screen. If protected detail dominates the low-level budget, split it into an independently streamed detail layer instead of pretending the budget passed.
  5. Maintain exact units, physical pivot and source-to-footprint pose for every level. Frame the hero around the asset; never recenter the asset to improve a screenshot. Preserve the same material colors. Separate reviewed virtual MPN marking from hero-only pad outlines, signal labels and silkscreen. Remove the hero-only helpers before producing board-use high and every lower level; retain physical terminals and high/medium MPN. Record the removed helper subtrees and geometric equivalence of retained chip geometry.
  6. Each manifest level records its relative path, SHA-256, compressed bytes, decoded attribute/index bytes, triangles, primitive instances/draw-call estimate, bounds, approximation/error settings and review status. Include generator versions, source hashes, source-to-display matrix, up axis, marking metadata and known exceptions. Use immutable content-addressed versions for consumers. No login tokens in published URLs or manifests.
  7. The high asset must support close inspection of the exact MPN in its reviewed location. Coarse variants must be checked for silhouette, underside/terminal shape, package seating, optical opening shape and pin-1 ambiguity. Do not publish a numerical simplification result as visually approved.

The native board substrate, copper, vias and silkscreen also need budgets. Component LOD alone does not fix thousands of board-surface primitives. Keep native manufacturing geometry intact; generate separate presentation derivatives.

Primary references: glTF Transform simplification, meshoptimizer.

Preserve small placement transforms when writing GLBs

Metre-scale component art can contain deliberate micrometre offsets that keep the reviewed virtual MPN visible on its chosen surface. Some exporters suppress near-identity transforms: glTF Transform 4.5.0's writer uses a default 1e-5 equality tolerance when omitting TRS values, which can discard a 6e-6 metre marking offset. Geometry can remain present while the marking sinks into the body.

Preserve exact local TRS or matrices through serialization. Read the written file back and compare retained node world transforms against high/source, with precision tighter than the smallest meaningful placement. Do not move or re-etch the reviewed source to compensate for an exporter error. Recheck actual top/side renders, not only mesh counts or an MPN-present flag. Prune unused hero materials as well as helper nodes and geometry, then refresh hashes, previews and downstream caches. The native substrate inside a physical module is part of that component and remains; only external board/reference substrate artwork is excluded.