← Commit history
README.md+74−105
@@ -1,149 +1,118 @@ # adom-3d-viewer-babylon9 -A fork of Colby's `adom-3d-viewer` (Babylon 7.54) bumped to Babylon 9.5.0 with-the redesigned Inspector v9. Built as an ESM bundle for downstream Adom tools-to vendor — chiplinter consumes it today, and we expect it to back the next-~10 Adom 3D viewers.+The Babylon 9.5 viewer engine behind every component page's 3D tab on+wiki.adom.inc. A fork of `adom-inc/3d-viewer` (Babylon 7.54) upgraded to+Babylon 9.5 with the redesigned Inspector v9, built as a versioned ESM bundle+that downstream tools vendor (the wiki's native component viewer, chiplinter,+and the next wave of Adom 3D apps).++This page is the canonical home: the source lives on the Files tab+(`adom-wiki repo clone adom/adom-3d-viewer-babylon9`), and each version's+built bundle is attached as a release asset you can pin.++## What is in 0.4.x++- Layers toolbar: slide-out per-layer visibility panel driven by the node+  naming convention (fr4_board, pad_top, silk, barrel, pin1_marker, ...).+- Z-fighting fixes for PCB models: 10x depth precision, polygon-offset+  tie-breaking for nested shells, near plane at radius/50, XY-area container+  ordering.+- Skybox mesh replaced by a screen-space background layer (tight far plane,+  faded ground rim): frameModel no longer fits a 5000-unit skybox.+- Sandbox storage guard: localStorage/sessionStorage access is wrapped, so the+  viewer initializes fully (lights, IBL, shadows) inside sandboxed iframes.+- Transparent radial-fade ground, hover tooltips, orbit-center UX,+  world-origin and mesh-local axis helpers, laser-etch text overlays.++## Get the bundle (pin a version)++Every release attaches the built bundle as a tarball asset: -## Why fork--Colby's `adom-3d-viewer` is the canonical viewer for InstaPCB previews and-chipfit, but it's pinned to Babylon 7.54 because chipfit-v2 + tscircuit ship-the same renderer. We needed Babylon 9's redesigned Inspector for chiplinter's-scene-graph debugging and didn't want to disturb Colby's surface area, so this-is a parallel fork.--## What's in the bundle--The build produces a single ESM entry plus code-split chunks:--```-adom-3d-viewer-babylon9.esm.js     ← entry, sets window.Adom3DViewerBabylon9-chunk-*.js                          ← code-split chunks (Babylon core, inspector, etc.)-VERSION+```bash+adom-wiki release download adom/adom-3d-viewer-babylon9 <version> adom-3d-viewer-babylon9-<version>.tar.gz+tar -xzf adom-3d-viewer-babylon9-<version>.tar.gz -C ./vendor/3d-viewer/ ``` -Loaded via:+The extracted `VERSION` file records exactly which build you have. The bundle+code-splits into ~60 chunks; serve them all from the same directory as the+entry (`adom-3d-viewer-babylon9.esm.js`) and browsers fetch chunks on demand.++## Embed it  ```html+<!-- Browser shim for Node-style globals that @babylonjs/inspector's React+     (Fluent UI) deps assume. Add BEFORE loading the bundle. -->+<script>+  window.process = window.process || { env: { NODE_ENV: "production" } };+  window.global = window.global || window;+</script>+ <script type="module">-  await import('/path/to/adom-3d-viewer-babylon9.esm.js');+  await import("./vendor/3d-viewer/adom-3d-viewer-babylon9.esm.js");   const v = window.Adom3DViewerBabylon9;-  v.init(host, { zUp: true, modelUrl: 'asset/foo.glb' });+  const viewer = v.init(host, { zUp: true, showViewCube: true });+  await viewer.loadModel("chip.glb");+  viewer.frameModel(); </script> ```  ## Why ESM (not IIFE)  Babylon 9's `@babylonjs/inspector` has circular imports that resolve to TDZ-when collapsed into a single IIFE scope (regardless of minifier). Vite's ESM-output preserves module boundaries so the inspector initializes cleanly.-Consumers load via `<script type="module">`, which all modern browsers-support.+when collapsed into a single IIFE scope, regardless of minifier. Vite's ESM+output preserves module boundaries so the inspector initializes cleanly. The+global is `window.Adom3DViewerBabylon9` (distinct from the legacy+`window.Adom3DViewer`), so both bundles can coexist during a migration.  ## API  ```js window.Adom3DViewerBabylon9 = {-  init(host, options),         // mounts the viewer in `host`, returns ViewerInstance-  rotateYUpToZUp(scene),       // for kicad-cli GLBs (Y-up) → adom viewer (Z-up)+  init(host, options),         // mounts the viewer, returns ViewerInstance+  rotateYUpToZUp(scene),       // kicad-cli GLBs (Y-up) -> adom viewer (Z-up)   addLaserEtch(scene, opts),   // bake a laser-etched chip-marking text overlay   BABYLON: <full @babylonjs/core namespace>,  // re-exported for consumers }; ```  `ViewerInstance` exposes:+ - `loadModel(url)` / `clearScene()` / `frameModel(fillFraction?)` - `getScene()` / `getEngine()` / `getCamera()` / `getShadowGenerator()` - `addContentRoot(node, opts?)` / `removeContentRoot(node)` - `toggleDebugLayer()` / `showDebugLayer()` / `hideDebugLayer()` - `setGroundVisible(visible)` / `goHome()` - `setProjectionMode(ortho)` / `getProjectionMode()`+- `toggleAxes("world" | "mesh-local", force?)` / `getAxesState()` - `destroy()` -The full `@babylonjs/core` namespace is exposed at `Adom3DViewerBabylon9.BABYLON`-so consumers don't need their own `import` side — chiplinter uses-`V.BAB.MeshBuilder.CreateDisc`, `V.BAB.PBRMaterial`, `V.BAB.Quaternion`,-`V.BAB.Tools.CreateScreenshotUsingRenderTarget`, etc. directly.--## Install (drop into a tool's vendor/3d-viewer/)+The full `@babylonjs/core` namespace is exposed at+`Adom3DViewerBabylon9.BABYLON` so consumers do not need their own import side.+chiplinter uses `V.BABYLON.MeshBuilder.CreateDisc`, `V.BABYLON.PBRMaterial`,+`V.BABYLON.Tools.CreateScreenshotUsingRenderTarget`, and friends directly. -The wiki ships the bundle as a tarball. Pull it into your tool's vendor-directory at install time:+## Build from source  ```bash-# Install everything to a known shared location-sudo mkdir -p /usr/local/share/adom-3d-viewer-babylon9-curl -fsSL https://wiki-ufypy5dpx93o.adom.cloud/static/apps/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.tar.gz \-  | sudo tar -xz -C /usr/local/share/adom-3d-viewer-babylon9--# Then symlink (or copy) into your tool's vendor/3d-viewer/-ln -sfn /usr/local/share/adom-3d-viewer-babylon9 /usr/local/bin/vendor/3d-viewer-```--Or just curl individual files if your tool only needs the entry (`adom-3d-viewer-babylon9.esm.js`):--```bash-curl -fsSL https://wiki-ufypy5dpx93o.adom.cloud/static/apps/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.tar.gz | tar -xz -C ./vendor/3d-viewer-```--## Browser shims required--The inspector's React deps (Fluent UI) assume a Node environment. Add this-shim before loading the bundle:--```html-<script>-  window.process = window.process || { env: { NODE_ENV: 'production' } };-  window.global = window.global || window;-</script>-<script type="module">-  await import('/path/to/adom-3d-viewer-babylon9.esm.js');-</script>-```--## Defaults (3d-viewer-design skill compliance)--| Rule | Status | Notes |-|---|---|---|-| §1 Babylon engine | ✅ | `@babylonjs/core` 9.5.0 |-| §3b Background gradient `#5a6b7e → #2a3340` | ✅ | `SceneBuilder.ts` |-| §4a HDRI environment | ✅ | bundled `.env` cube texture |-| §4b Bottom-light toggle | ✅ | exposed via consumer toolbar (HemisphericLight ground-color boost) |-| §4d Ground plane + ShadowGenerator(8192) | ✅ | medium-gray ground, blur PCF, optional via `showGround` prop |-| §5a PBRMaterial default | ✅ | every internal material is PBR |-| §6a `zoomToMouseLocation = true` | ✅ | `AdomCamera.ts` |-| §6c Shift+Alt+Click recenter | ✅ | `AdomCamera.ts` |-| §7 ViewCube + tween presets | ✅ | `ViewCubeBuilder.ts` |-| **§8a World-origin axes (default ON)** | ✅ **v0.2.0** | R/G/B at scene origin, scaled to 15% of scene radius via `refreshAxisScale` after each `frameModel` |-| **§8b Mesh-local axes (default OFF, toggleable)** | ✅ **v0.2.0** | parented to each loaded GLB root via `addMeshLocalAxes` |-| **§8c Screen-space corner triad (always on)** | ⚠ **deferred to v0.3.0** | Second-camera-with-viewport approach didn't render — `engine.runRenderLoop(() => scene.render())` honors `scene.activeCamera` only, not the `activeCameras` array. v0.3.0 will use `UtilityLayerRenderer` with an explicit secondary `engine.render()` pass. §8a + §8b cover the bulk of "where is origin" debugging in the meantime. |-| §6b.i Adaptive `wheelDeltaPercentage` (`100/R`) | ⚠ open | currently a constant `0.1`; pan + radius limits ARE adaptive |-| §11 Y-up→Z-up | ✅ | `rotateYUpToZUp(scene)` exposed on the global |--## §8 axis-helper API (v0.2.0)--```js-// World axes (default ON) — R/G/B at scene origin, sized to 15% of scene radius.-viewer.toggleAxes('world');                      // toggle-viewer.toggleAxes('world', true);                // explicit set-viewer.getAxesState();                           // → { world: bool, meshLocal: bool }--// Mesh-local axes (default OFF) — auto-attaches to each loaded GLB root.-viewer.toggleAxes('mesh-local');                 // toggle+adom-wiki repo clone adom/adom-3d-viewer-babylon9+cd adom-3d-viewer-babylon9+npm install+npx vite build --config vite.standalone.config.ts   # -> dist-standalone/ ``` -Reach the helpers directly via `scene.metadata.__adomAxes` if you want to add-or remove per-root helpers programmatically (e.g. while debugging a custom-loader path that bypasses `loadModel`).+`npm run build` (plain `vite build`) produces the npm-consumable `dist/`+library instead; `dist-standalone/` is the self-contained browser bundle the+wiki and release assets ship.  ## Consumers -- `adom-chiplinter` — vendors `dist-standalone/` into `vendor/3d-viewer/`-- (future) `adom-chipfit-v3` — when v2 lands its own Babylon 9 upgrade-- (future) standalone scene-graph utility scripts+- wiki.adom.inc component pages: git-wiki vendors `dist-standalone/` into+  `static/vendor/adom-3d-viewer-babylon9` and pins it via `VIEWER_BUNDLE_VER`.+- `adom-chiplinter`: vendors the release tarball into `vendor/3d-viewer/`.+- Downstream viewer work is tracked on adom/wiki issues (#48, #53, #60). -## Source+## Development -Source code lives at `adom-inc/adom-3d-viewer-babylon9` (private repo). The-canonical install artifact is the wiki tarball.+Source of record is this page's repo. GitHub `adom-inc/adom-3d-viewer-babylon9`+is the working mirror where CI and day-to-day commits happen; each released+version is ported here (source push + package publish + bundle release asset).
SKILL.md+43−3
@@ -1,7 +1,47 @@ --- name: adom-3d-viewer-babylon9+user-invocable: true description: >-  Fork of Colby's adom-3d-viewer (Babylon 7.54) bumped to Babylon 9.5 with the redesigned Inspector v9. Vendored ESM bundle for downstream Adom tools (chiplinter, chipfit-v2, future viewers). Distribute+  Embed the Adom 3D viewer (Babylon 9.5 ESM bundle) in a page or tool: load GLB+  models with Z-up CAD framing, view cube, layers toolbar, ground shadows, and+  laser-etch overlays. Use when a page or app needs to render a PCB, component,+  or any GLB in 3D, pin a specific viewer version, or vendor the bundle into a+  downstream tool. Triggers: 3d viewer, show glb, render pcb in 3d, babylon+  viewer, layers toolbar, vendor the viewer bundle. ----# adom-3d-viewer-babylon9 — Babylon 9.5 viewer + Inspector-Fork of Colby's adom-3d-viewer (Babylon 7.54) bumped to Babylon 9.5 with the redesigned Inspector v9. Vendored ESM bundle for downstream Adom tools (chiplinter, chipfit-v2, future viewers). Distribute+# adom-3d-viewer-babylon9++The Babylon 9.5 viewer engine behind every component page's 3D tab on+wiki.adom.inc. Ships as a versioned ESM bundle (entry + code-split chunks).++## Get the bundle++Pinnable, versioned artifact (recommended for tools that vendor it):++```bash+adom-wiki release download adom/adom-3d-viewer-babylon9 <version> adom-3d-viewer-babylon9-<version>.tar.gz+tar -xzf adom-3d-viewer-babylon9-<version>.tar.gz -C ./vendor/3d-viewer/+```++The extracted VERSION file records exactly which build you have.++## Embed it++```html+<script>+  window.process = window.process || { env: { NODE_ENV: "production" } };+  window.global = window.global || window;+</script>+<script type="module">+  await import("/vendor/3d-viewer/adom-3d-viewer-babylon9.esm.js");+  const v = window.Adom3DViewerBabylon9;+  const viewer = v.init(host, { zUp: true });+  await viewer.loadModel("model.glb");+  viewer.frameModel();+</script>+```++Full API (loadModel, frameModel, toggleAxes, layers toolbar, laser etch,+BABYLON namespace re-export) is documented in the README on this page. Source+lives on the Files tab; `adom-wiki repo clone adom/adom-3d-viewer-babylon9`+gets you a working checkout.
VERSIONadded+1
@@ -0,0 +1 @@+0.4.3
install.sh+20−14
@@ -1,15 +1,21 @@-#!/bin/bash-set -e-PKG_DIR="$(cd "$(dirname "$0")" && pwd)"-SKILLS_DIR="$HOME/.claude/skills"-mkdir -p "$SKILLS_DIR/adom-3d-viewer-babylon9"-if [ -f "$PKG_DIR/SKILL.md" ]; then-  cp "$PKG_DIR/SKILL.md" "$SKILLS_DIR/adom-3d-viewer-babylon9/SKILL.md"+#!/usr/bin/env bash+# Install the adom-3d-viewer-babylon9 bundle: fetch this version's built ESM+# bundle (release asset) into a shared vendor location tools can symlink.+set -euo pipefail+cd "$(dirname "$0")"+V=$(tr -d '[:space:]' < VERSION)+DEST="${ADOM_3D_VIEWER_DIR:-$HOME/.local/share/adom-3d-viewer-babylon9}"+TMP=$(mktemp -d)+trap 'rm -rf "$TMP"' EXIT+adom-wiki release download adom/adom-3d-viewer-babylon9 "$V" --platform any --out "$TMP"+TAR="$TMP/adom-3d-viewer-babylon9-$V.tar.gz"+if [ ! -f "$TAR" ]; then+  echo "ERROR: release asset adom-3d-viewer-babylon9-$V.tar.gz did not download" >&2+  exit 1 fi-for skill_dir in "$PKG_DIR/skills"/*/; do-  [ -d "$skill_dir" ] || continue-  skill_name=$(basename "$skill_dir")-  mkdir -p "$SKILLS_DIR/$skill_name"-  cp -r "$skill_dir"* "$SKILLS_DIR/$skill_name/"-done-echo "Installed adom-3d-viewer-babylon9"+mkdir -p "$DEST.new-$$"+tar -xzf "$TAR" -C "$DEST.new-$$"+rm -rf "$DEST"+mv "$DEST.new-$$" "$DEST"+echo "OK: adom-3d-viewer-babylon9 $V installed at $DEST"+echo "Hint: load $DEST/adom-3d-viewer-babylon9.esm.js via <script type=\"module\">; serve the whole directory (code-split chunks)."
package.json+37−4
@@ -1,11 +1,44 @@ {-  "slug": "adom-3d-viewer-babylon9",-  "version": "1.0.0",+  "name": "adom-3d-viewer-babylon9",+  "version": "0.4.3",+  "description": "Fork of adom-inc/3d-viewer upgraded to Babylon 9.5 with the redesigned Inspector + 3d-viewer-design-skill-compliant defaults (background gradient, bottom-light toggle, medium-gray ground plane, world-origin axes).",   "type": "app",-  "description": "Fork of Colby's adom-3d-viewer (Babylon 7.54) bumped to Babylon 9.5 with the redesigned Inspector v9. Vendored ESM bundle for downstream Adom tools (chiplinter, chipfit-v2, future viewers). Distribute",   "dependencies": {},+  "slug": "adom-3d-viewer-babylon9",+  "license": "MIT",+  "tags": [+    "3d",+    "viewer",+    "babylon",+    "glb",+    "pcb",+    "component-pages"+  ],+  "hero": {+    "headline": "Adom 3D Viewer",+    "subhead": "The Babylon 9 engine behind every component page",+    "screenshot": "viewer-screenshot.png"+  },+  "discovery_triggers": [+    "embed a 3d viewer for a glb model",+    "show a pcb or component in 3d",+    "babylon viewer for adom pages",+    "load the adom 3d viewer bundle",+    "layers toolbar for a 3d board view"+  ],+  "discovery_pitch": "The Babylon 9.5 ESM viewer engine that renders every component page's 3D tab on wiki.adom.inc: GLB loading, view cube, layers toolbar, shadows, laser-etch text, Z-up CAD framing.",+  "sample_prompts": [+    {+      "label": "Embed the viewer",+      "prompt": "Load the adom 3d viewer bundle into my page and show model.glb"+    },+    {+      "label": "Pin a version",+      "prompt": "Download the 0.4.3 viewer bundle so my tool vendors a fixed build"+    }+  ],   "scripts": {     "install": "./install.sh",     "uninstall": "./uninstall.sh"   }-}+}\ No newline at end of file
page.json+40−21
@@ -4,27 +4,24 @@   "slug": "adom-3d-viewer-babylon9",   "title": "adom-3d-viewer-babylon9 — Babylon 9.5 viewer + Inspector",   "brief": "Fork of Colby's adom-3d-viewer (Babylon 7.54) bumped to Babylon 9.5 with the redesigned Inspector v9. Vendored ESM bundle for downstream Adom tools (chiplinter, chipfit-v2, future viewers). Distribute",-  "version": "0.2.0",-  "tags": [],+  "version": "0.4.3",+  "tags": [+    "3d",+    "viewer",+    "babylon",+    "glb",+    "pcb",+    "component-pages"+  ],   "license": "MIT",   "discovery_triggers": [-    "adom-3d-viewer-babylon9",-    "babylon 9 viewer",-    "babylon 9.5 viewer",-    "babylon inspector v9",-    "3d viewer babylon 9",-    "vendor 3d viewer",-    "babylonjs upgrade",-    "upgrade babylon viewer",-    "newer babylon inspector",-    "fork adom-3d-viewer",-    "rotateYUpToZUp",-    "addLaserEtch",-    "Adom3DViewerBabylon9",-    "esm babylon bundle",-    "chip 3d viewer babylon 9"+    "embed a 3d viewer for a glb model",+    "show a pcb or component in 3d",+    "babylon viewer for adom pages",+    "load the adom 3d viewer bundle",+    "layers toolbar for a 3d board view"   ],-  "discovery_pitch": "Fork of Colby's adom-3d-viewer bumped to Babylon 9.5 with the redesigned Inspector v9. Ships as an ESM bundle (vite build) you vendor into your tool — chiplinter and the next 10 Adom 3D apps build on this. Includes rotateYUpToZUp, addLaserEtch, and exposes the full @babylonjs/core namespace via window.Adom3DViewerBabylon9.BABYLON.",+  "discovery_pitch": "The Babylon 9.5 ESM viewer engine that renders every component page's 3D tab on wiki.adom.inc: GLB loading, view cube, layers toolbar, shadows, laser-etch text, Z-up CAD framing.",   "install": {     "binary_name": "adom-3d-viewer-babylon9",     "install_dir": "",@@ -39,10 +36,32 @@   "visibility": {     "public": true   },-  "hero": null,-  "sample_prompts": [],+  "hero": {+    "type": "billboard",+    "headline": "Adom 3D Viewer",+    "subhead": "The Babylon 9 engine behind every component page",+    "screenshot": "viewer-screenshot.png"+  },+  "sample_prompts": [+    {+      "label": "Embed the viewer",+      "prompt": "Load the adom 3d viewer bundle into my page and show model.glb"+    },+    {+      "label": "Pin a version",+      "prompt": "Download the 0.4.3 viewer bundle so my tool vendors a fixed build"+    }+  ],   "metadata": {},   "created_at": "2026-05-28T05:29:10.602Z",   "updated_at": "2026-05-28T05:29:10.602Z",-  "skills": []+  "skills": [],+  "name": "adom-3d-viewer-babylon9",+  "description": "Fork of adom-inc/3d-viewer upgraded to Babylon 9.5 with the redesigned Inspector + 3d-viewer-design-skill-compliant defaults (background gradient, bottom-light toggle, medium-gray ground plane, world-origin axes).",+  "dependencies": {},+  "scripts": {+    "install": "./install.sh",+    "uninstall": "./uninstall.sh"+  },+  "org": "adom" }\ No newline at end of file
uninstall.sh+5−4
@@ -1,4 +1,5 @@-#!/bin/bash-set -e-rm -rf "$HOME/.claude/skills/adom-3d-viewer-babylon9"-echo "Uninstalled adom-3d-viewer-babylon9"+#!/usr/bin/env bash+set -euo pipefail+DEST="${ADOM_3D_VIEWER_DIR:-$HOME/.local/share/adom-3d-viewer-babylon9}"+rm -rf "$DEST"+echo "OK: adom-3d-viewer-babylon9 removed from $DEST"
viewer-screenshot.pngadded
⋯ 1 unchanged line ⋯