Skip to content

Give the demo GLBs the up axis glTF defines - #1

Merged
kai-kircher merged 1 commit into
mainfrom
fix/glb-up-axis
Sep 7, 2026
Merged

kai-kircher merged 1 commit into
mainfrom
fix/glb-up-axis

Conversation

@kai-kircher

Copy link
Copy Markdown
Contributor

STEP and the OpenCASCADE kernel behind the CAD converter are Z-up; glTF 2.0 mandates +Y up. The converter emitted its geometry under a bare {"mesh": 0} node with no transform, so every model in these datasets reached the viewer lying on its back. Cascadia-App fixed the converter in "Give converted CAD models the up axis glTF defines"; this applies the same correction to the models already baked here.

Backfilled, not re-converted

scripts/fix-glb-up-axis.mjs from Cascadia-App rewrites only the GLB JSON chunk, leaving the vertex buffer byte-for-byte alone. That matters more here than the saved CPU:

  • Regenerating robot-arm/ needs the gitignored STEP sources and a converter image that isn't published yet.
  • Regenerating freecad-demo/ means an hour of FreeCAD + KiCad that mints fresh UUIDs every run, destroying the determinism the bundle exists to provide.

Leaving the accessors untouched also keeps cad_metadata's polygon counts and bounding boxes true, and keeps the native part coordinates the version-comparison overlay needs to register two revisions without a registration step.

What changed

Path Change
robot-arm/glb/ 79 GLBs rewritten in place — its manifest records no hashes
freecad-demo/files/ 120 GLB blobs renamed to their new SHA-256
freecad-demo/manifest.json 120 blob-inventory keys repointed, sizes updated
freecad-demo/tables/vault_files.json 191 rows: file_hash, content_sha256, file_size

The 191-vs-120 gap is blob dedup — several vault rows share a GLB. Nothing else in the bundle carries a hash. vault_files.json is re-sorted with the comparator bake-freecad-demo.ts uses, so a later re-bake still compares clean.

Thumbnails are unchanged and were never wrong: they render through OCC's own Z-up View_Iso(), which is why the geometry was correct in one path and wrong only in the other.

Verification

All 616 blobs still hash to their own filenames; manifest ↔ disk agree both directions with sizes matching; every vault_files.file_hash resolves; all 199 GLBs carry exactly the −90° X quaternion on a single reachable mesh node; the rewrite is idempotent. The workflow's own guard (79 GLB + 79 thumbnails, no STEP) holds.

The decisive check was geometry rather than structure:

PUC-0000   world extent X,Y,Z: 1450.3, 1163.9, 772.0   floor Y=0.01, top Y=1163.95
USV-0000   world extent X,Y,Z: 3155.0, 1491.0, 1490.0  hull Y=-160, mast Y=1331

The cart's wheels land on the ground plane with its height in world Y, and the USV's "3 m" is its X extent with the hull below the waterline — both upright, matching the readings that diagnosed the bug.

Note for reviewers

The diff shows renames in freecad-demo/files/ at 91–99% similarity. That is the content-addressed store doing its job: the JSON chunk changed, so the name had to.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PGx2UWz6ZhqQu9KrT5zCWv

STEP and the OpenCASCADE kernel behind the CAD converter are Z-up; glTF
2.0 mandates +Y up. The converter emitted its tessellated geometry under
a bare `{"mesh": 0}` node with no transform, so every model in these
datasets reached the viewer lying on its back. Cascadia-App fixed the
converter in "Give converted CAD models the up axis glTF defines"; this
applies the same correction to the models already baked here.

The rotation is backfilled rather than re-converted. Cascadia-App's
scripts/fix-glb-up-axis.mjs rewrites only the GLB JSON chunk, leaving
the vertex buffer byte-for-byte alone, which matters more here than the
saved CPU: regenerating robot-arm needs the gitignored STEP sources and
a converter image that does not exist yet, and regenerating
freecad-demo means an hour of FreeCAD and KiCad that mints fresh UUIDs
every run — destroying the determinism the bundle exists to provide.
Leaving the accessors untouched also keeps cad_metadata's polygon counts
and bounding boxes true, and keeps the native part coordinates that let
the version-comparison overlay register two revisions without a
registration step.

robot-arm/glb is 79 plain files whose manifest records no hashes, so
they are rewritten in place. freecad-demo/files is content-addressed:
rewriting a blob changes its SHA-256, so each of the 120 GLB blobs is
renamed to its new hash, manifest.json's blob inventory is repointed,
and the 191 vault_files rows that referenced one — 120 blobs, shared by
dedup — get file_hash, content_sha256 and file_size updated. Nothing
else in the bundle carries a hash. vault_files.json is re-sorted with
the comparator bake-freecad-demo.ts uses, so a later re-bake still
compares clean.

Thumbnails are unchanged and were never wrong: they render through
OCC's own Z-up View_Iso(), which is why the geometry was correct in one
path and wrong only in the other.

Verified beyond the structural checks that all 616 blobs still hash to
their own names and every reference resolves: the PUC cart now stands
1164 mm tall in world Y with its wheels on the ground plane at Y = 0.01,
and the USV's 3 m is its X extent with the hull below the waterline.
Both upright, matching the readings that diagnosed the bug.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PGx2UWz6ZhqQu9KrT5zCWv
@kai-kircher
kai-kircher merged commit 33a8f2e into main Sep 7, 2026
1 check passed
@kai-kircher
kai-kircher deleted the fix/glb-up-axis branch September 7, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant