← All Pull Requests

Point the skill at the Adom viewer library; gallia/viewer is gone #1

Open opened by AdityaAngajala

Points this skill at the Adom viewer library instead of gallia/viewer/, which was removed in May 2026.

  • Section 2 ("Use the canonical Adom Babylon viewer as the baseline") is replaced by the shared block: the page's 3D tab for hardware pages, ::adom-3d in a README, and importing the library for apps. The tiers, the MCP tools av_3d_display / av_basic_3d_display, and the gallia/viewer upstream workflow went with it.
  • The description, intro, section 6e rule, the pitfalls checklist and the closing line now name the library.
  • A note under the intro says that the remaining gallia/viewer/ file paths and the old window.Adom3DViewer API in later sections describe the retired viewer. The design rules themselves (background, lighting, camera, axes) are unchanged.

This is part of consolidating the 3D viewers: Adom has one viewer library (adom/adom-3d-viewer, source on GitHub adom-inc/adom-3d-viewer-babylon9), and the skills that tell agents to copy an old bundle or start from the removed gallia/viewer are where new copies come from. The same short "use the Adom viewer" block now goes into each skill that covers viewers.

After merging, publish a new version of the skill so agents pick it up.

🤖 Generated with Claude Code

Diff Skip to comments

--- a/SKILL.md+++ b/SKILL.md@@ -1,1307 +1,1109 @@⋯ 3 unchanged lines ⋯   Design rules for any 3D viewport Claude generates inside Adom — CAD,   EDA, mechanical, PCB, component preview, schematic 3D, molecule   viewer, any WebGL canvas. The headline rule: always use the Adom-  Babylon viewer at `gallia/viewer/` as the baseline — don't rebuild-  from scratch, extend it. Covers engine choice (Babylon, never Three),+  Babylon viewer (the Adom viewer library, adom/adom-3d-viewer) as the+  baseline — don't rebuild from scratch, extend it. Covers engine choice (Babylon, never Three),   canonical-viewer reuse + upstream contribution workflow, background   color (gradient, never pure black/white), HDRI + hemispheric   lighting, PBR material fixups, ArcRotateCamera defaults including⋯ 28 unchanged lines ⋯ fixed orbit center makes every rotation on a large assembly feel like flying blind. Everything below is either (a) a rule Claude keeps getting wrong from first principles or (b) a goodie the team already-baked into the canonical Adom Babylon viewer at `gallia/viewer/` that-deserves to be the default everywhere.+baked into the canonical Adom Babylon viewer that deserves to be the+default everywhere. +> **Where the viewer lives now.** `gallia/viewer/` was removed in May 2026. Its successor is the Adom viewer library ([adom/adom-3d-viewer](https://wiki.adom.inc/adom/adom-3d-viewer)), source on GitHub `adom-inc/adom-3d-viewer-babylon9`, global `window.Adom3DViewerBabylon9`. Sections below that still name a `gallia/viewer/` file or the old `window.Adom3DViewer` API describe that retired viewer; the library's README lists the current API.++ ---  ## 1. Engine choice — always Babylon.js, never Three.js⋯ 27 unchanged lines ⋯ - **Scene inspector.** Babylon's built-in Inspector   (`scene.debugLayer`) is a debugger's dream for material and lighting   issues. Three has no equivalent shipped with the engine.-- **Consistency with the canonical viewer.** `gallia/viewer/` — see-  §2 — is Babylon. One engine ecosystem-wide means every Adom+- **Consistency with the canonical viewer.** The Adom viewer library+  (§2) is Babylon. One engine ecosystem-wide means every Adom   viewer inherits every improvement for free.  Claude will feel pulled toward Three. Resist it. If you find yourself⋯ 4 unchanged lines ⋯  --- -## 2. Use the canonical Adom Babylon viewer as the baseline — extend, don't fork--**The rule:** every new Adom app that needs 3D starts from the-canonical Adom Babylon viewer at `gallia/viewer/`. Not from a blank-Babylon `new Scene()`. Not from a Babylon playground snippet. Not-from a fresh `create-babylon-app`. **From the canonical viewer.**--The canonical viewer already solves — or is the right place to solve —-every problem in this skill. If you build a new viewer from scratch-for your new app, you are either (a) re-implementing what already-exists and drifting, or (b) solving it wrong and shipping regressions-the canonical viewer would have caught.--### 2a. What the canonical viewer gives you for free--Out of the box, `gallia/viewer/` ships with:--- **Babylon engine + `environmentSpecular.env` HDRI** already bundled-  (`gallia/viewer/babylon-bundle.min.js`, `viewer/js/environmentSpecular.env`).-- **ArcRotateCamera with soft limits** (§6b) and behavior strip-  (`3d.html:293`).-- **ViewCube / view presets** — front / back / left / right / top /-  bottom / isometric buttons wired to the correct Z-up-  `alpha`/`beta` angles (see §7). Click a face, camera tweens.-- **World-origin axis helper** — R/G/B X/Y/Z gizmo at (0,0,0) visible-  by default so the user can always see which way is up and where-  the scene's origin lives (see §8). Toggleable but default-on.-- **Bottom-light toggle** for PCB under-chip inspection (§4b).-- **GLB loader with Y-up → Z-up handling** (§11) and-  `applyGlbZUpTransform(viewer, glbSource)` helper.-- **Measurement tool** with vertex snapping + auto-scaled markers (§9).-- **Cinematic camera tour** (auto-play on model load, 11-phase-  choreographed reveal).-- **AI-drivability surface** — `window.Adom3DViewer` global +-  `postMessage` protocol + console forwarding (§10).-- **Shadow ground mesh** (`shadowGround`) for soft contact shadows.-- **MCP tool integration** — callable as `av_3d_display` /-  `av_basic_3d_display` from any Claude agent.--Reuse path: embed the viewer in your app, or use the Basic3dView-entry point (`gallia/viewer/3d-viewer-standalone.ts`) as your starter,-or call the MCP tool to open the viewer in Hydrogen. Pick whichever-matches your app's surface — but start from this base.--### 2b. The upstream-first workflow for new best practices--When you discover a best practice the canonical viewer is missing —-the gradient background in §3 is the flagship current example, but-so is zoom-to-mouse (§6a), orbit-center recentering (§6c), or-anything else that lands in this skill — the workflow is:--1. **Add it to the canonical viewer first.** Land a PR in-   `gallia/viewer/` that adds the feature as a baseline default.-   Include a toolbar toggle if it's opinionated.-2. **Update this skill** to reflect that the canonical viewer now-   supports it (move from "known migration debt" to "you get this-   for free").-3. **Delete workarounds** from downstream apps. If a downstream app-   copy-pasted a hack to fix the missing behavior, remove it — the-   app should inherit from the canonical viewer now.-4. **Roll out via the Adom update pipeline.** All consumers get the-   new default automatically on their next `adom update` or workspace-   refresh. No per-app migration required.--### 2c. Do NOT do any of these--- **Do not fork the viewer into your app's repo.** Forks drift. A-  feature added to the canonical viewer never makes it into your-  fork, and a bug fixed in your fork never makes it back.-- **Do not write a parallel mini-viewer** to "just show a GLB-  quickly." `Basic3dView` already exists for that use case-  (`basic-3d-viewer` skill). Use it.-- **Do not ship app-local workarounds for viewer bugs.** File them-  against `gallia/viewer/` and fix them there.-- **Do not re-implement ViewCube, measurement, HDRI loading, or-  bottom-light-toggle per-app.** Inherit from the canonical viewer.--### 2d. Current canonical-viewer debt — improve it, don't route around it--The canonical viewer predates some of the rules in this skill. As-of 2026-04-24:--- Clear color is flat near-black `Color3(0.05, 0.06, 0.08)`-  (`fp-to-3d.js:~1642`) — should be the gradient in §3. **Fix-  upstream per §2b.**-- `cam.zoomToMouseLocation` is not explicitly set on all camera-  construction paths — audit and set it on every ArcRotateCamera-  (§6a).-- Orbit-center recentering (§6c) doesn't exist yet — add as a new-  feature to the canonical viewer, not as a per-app hack.-- Mesh-local axis helpers (§8b) and the screen-space corner triad-  (§8c) don't exist yet — audit and add upstream. The world-origin-  helper (§8a) may or may not be present; verify and make it-  default-on if missing.--These are the next PRs for `gallia/viewer/`. None of them is more-than a ~20–40-line change.--### 2e. How to extend — the 5-tier layering decision matrix--"Extend, don't fork" (§2c) is the rule. **Layering** is the-implementation. There are five tiers, ordered from most-embedded-(preferred) to least-embedded (rare, last resort). Pick the highest-tier that works for your app.--#### Tier 1 — Pure embed in a Hydrogen webview or AV panel *(90%+ of apps)*--You write zero viewer code. Your app opens the canonical viewer in a-Hydrogen tab (or the AV panel), passes a GLB path + a few config-knobs, and drives it via `postMessage`. Every future improvement to-the canonical viewer (brightened gradient, axis helpers, new-toolbar buttons) shows up in your app automatically on the next-`adom update`. **Default to this tier.** Apps like shotlog,-parts-search, library-review, chipfit, 3d-component-creator, and-adom-tsci all belong here. If you're tempted to leave this tier,-prove it to yourself first by listing exactly what the canonical-viewer can't do and asking whether adding it upstream (§2b) would-serve everyone.--#### Tier 2 — MCP tool call *(simplest path)*--`av_3d_display({ glb_path, title, ... })` or-`av_basic_3d_display({ glb_path, title })` from the Claude side. No-browser code in your app at all. Use this when your "app" is-fundamentally an AI pipeline that ends in "show this to the user" —-a one-shot display, a generated preview, a datasheet render. Same-inherited behavior as Tier 1.--#### Tier 3 — Import `Basic3dView` into your own canvas host--`gallia/viewer/3d-viewer-standalone.ts` exposes-`window.Adom3DViewer.init(canvasEl, opts)`. You host the canvas in-your own DOM (for layout reasons — you want the viewer inside your-app's workspace tab instead of a separate panel), but Babylon scene-setup, HDRI, camera defaults, GLB loader, Y-up→Z-up transform, axis-helpers, pivot sphere, and bottom-light toggle are all inherited.-**This is the sweet spot when you need a 3D tab inside your app's-workspace rather than a separate panel.**--#### Tier 4 — Canonical viewer + extension hooks (plugin-style)--When you need one or two custom pieces — an app-specific toolbar-button, a custom `scene.onBeforeRender` observer, a scene-graph-annotation your app owns, a net-highlight overlay for PCB routing —-you add the *extension points* upstream first (§2b workflow), then-use them from your app. The canonical viewer becomes an extensible-host, not a closed box. If it doesn't expose the hook you need,-**land the hook upstream before your app ships.** Don't let missing-hooks push you to Tier 5 unless there's genuinely no way to-generalize them.--#### Tier 5 — Roll your own, but still Babylon, still inherit helpers *(last resort)*--Very rare. When justified, you still import `@babylonjs/core`, still-call `applyGlbZUpTransform`, `applyAdomViewportDefaults`,-`applyAdomCameraDefaults`, the axis helper functions, the-pivot-sphere wiring, the CSS gradient. Every §1–§15 rule still-applies. You're rolling your own *scene orchestration*, not your-own rendering stack.--### 2f. Three-question decision flow--1. **Is your app's 3D "view this model / scene data"?** → **Tier 1-   or 2 embed.** Stop here. If you're thinking "but I need a custom-   layout," re-ask #1 — most custom-layout needs are "I want my own-   panel chrome around a standard viewer," which is an embed with a-   styled wrapper, not a custom viewer.-2. **Does your app need the canvas inside its own DOM / workspace-   tab?** → **Tier 3 (Basic3dView import).** You still inherit-   everything; you just get to pick the canvas parent.-3. **Do you need custom scene behavior the canonical viewer can't be-   taught?** → **Tier 4.** Add the hook upstream, then use it. Only-   jump to Tier 5 if you're certain the behavior doesn't generalize.--### 2g. Signals you should NOT roll your own--- *"The canonical viewer doesn't have feature X"* → add X upstream-  (§2b). If it generalizes, everyone benefits; if it doesn't, it-  probably shouldn't be in a shared viewer anyway.-- *"I need a custom toolbar."* → the canonical viewer's toolbar can-  be extended. Add the extension point upstream if it isn't there.-- *"I need different default materials."* → set them via-  `tweak_scene` postMessage (§10b) or on init. Not a rolling reason.-- *"I want my own layout around the canvas."* → Tier 3 import lets-  you own the layout without forking the scene.-- *"Three.js has a library that does X."* → see §1. No.--### 2h. Signals you might legitimately roll your own--- **Render-to-texture pipelines** — ML training data generation,-  simulation frames streaming, deterministic render farms. The-  canonical viewer is a UI; you need a renderer-as-service.-- **Hybrid 2D+3D canvases** with custom layout math where 3D is-  incidental (e.g. a schematic tool where 3D is a hover preview).-- **Realtime streaming / headless rendering** — WebRTC pipeline,-  cloud-rendered output, server-side render.-- **Fundamentally different rendering model** — ray tracing demo,-  Monte Carlo renderer, shader-education tool, game engine.-- **Your app's primary purpose IS 3D** in a way PCB/CAD viewing-  isn't a use case (physics sim, generative art tool). Here the-  canonical viewer is just the wrong primitive.+## 2. Use the Adom viewer: extend it, don't fork it -Even in these cases, §1 (Babylon) and the §2a helper-function-imports still apply. Don't abandon the pattern library — just the-specific entry point.+Adom has one 3D viewer: the Adom viewer library (wiki page [adom/adom-3d-viewer](https://wiki.adom.inc/adom/adom-3d-viewer), Babylon 9). Pick the first option that does the job: -### 2i. One-line summary+1. **A model on a hardware page:** put the GLB on the page and the page's 3D tab shows it. Layers, intros, tooltips, switchable groups and lights come from the GLB's `extras` (the `wiki-hero-glb` skill in adom/adom-wiki-skillpack lists them); viewer options come from `component.viewer_3d` in page.json. Add no viewer of your own.+2. **A model inside a README:** the `::adom-3d` directive, for example `::adom-3d{src="/<owner>/<slug>/render/model.glb" heading="..." caption="..."}`.+3. **An app or custom page that needs more** (its own panels, animation, picking): import the library and build on it. On the wiki, load `https://wiki.adom.inc/static/vendor/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.esm.js` with no `?v=` pin, then call `Adom3DViewerBabylon9.init(host, { zUp: true })`; `await Adom3DViewerBabylon9.loadBabylon()` returns the whole Babylon engine. Inside a readme.html, follow the sandbox notes in the `wiki-readme-html` skill. A tool that ships offline pins a release instead: `adom-wiki release download adom/adom-3d-viewer <version> adom-3d-viewer-babylon9-<version>.tar.gz`. -**Embed if you can, import if you must, roll if you're sure — and-never leave the canonical viewer's pattern library behind,-regardless of tier.**+Never copy a viewer bundle into a page or repo (`adom-3d-viewer.min.js`, or any Babylon or three.js build), and never start a new three.js, model-viewer or bare Babylon scene. If the library lacks something you need, open an issue or pull request on [adom-inc/adom-3d-viewer-babylon9](https://github.com/adom-inc/adom-3d-viewer-babylon9).  --- ⋯ 5 unchanged lines ⋯   anodized aluminum, dark silicon) vanish into the void. Ambient   occlusion cannot read — shadows cannot be darker than the background. - **Near-black (`rgb(0.05, 0.06, 0.08)`)**: current canonical viewer-  default — almost as bad as pure black. Migration target per §2d.+  default — almost as bad as pure black. - **Pure white (`#fff`)**: white silkscreen, white plastic, chrome   blow out. Retinal fatigue after 10 minutes. Clashes with Adom's   dark UI chrome.⋯ 391 unchanged lines ⋯   orbits around the current (possibly recentered) target. Users   learn the chord; they don't have to use it. -Ship this in the canonical viewer first (§2b), delete it from any+Ship this in the library first, delete it from any downstream workaround.  ### 6d. Defaults⋯ 16 unchanged lines ⋯ Axis helpers. Depth-testing on those helpers. Corner triad with labels. The Adom/CNC coordinate convention (§8f). View-preset `alpha`/`beta` table. None of it is obvious up-front. All of it already exists —-correct, tested, consistent — in `gallia/viewer/`.+correct, tested, consistent — in the Adom viewer library.  The rationalization Claude will make: "the canonical viewer is heavy and my app's use case is narrow, so copy-pasting Babylon init is⋯ 7 unchanged lines ⋯  **Rule:** if you catch yourself about to write `new BABYLON.Scene()` or `new BABYLON.Engine()` in a new Adom app, stop. Start from-`gallia/viewer/` per §2. If the canonical viewer is genuinely missing-the feature you need, take the upstream-first path (§2b) — land the-fix in `gallia/viewer/` first, then delete the downstream workaround.+the Adom viewer library per §2. If it is genuinely missing the+feature you need, land the feature in the library first (an issue or+pull request on adom-inc/adom-3d-viewer-babylon9), then delete the+downstream workaround. Do not rationalize a parallel implementation because it feels quicker.  Documented 2026-04-24 after step2glb's preview viewer hit every single⋯ 424 unchanged lines ⋯ ## 14. Pitfalls checklist  - [ ] Engine is **Babylon.js**. No `import * as THREE from 'three'`.-- [ ] Starts from the canonical Adom Babylon viewer at-      `gallia/viewer/`, not from a blank Babylon scene.-- [ ] New best-practices were added to the canonical viewer first-      (§2b), not as downstream hacks.+- [ ] Uses the Adom viewer library (§2), not a blank Babylon scene+      or a copied bundle.+- [ ] New best practices were added to the library first, not as+      downstream hacks. - [ ] Background is vertical gradient **`#5a6b7e` → `#2a3340`** (v1.3       field-fix pass — both ends brightened after v1.1's "brighten       only the top" still lost black chips in the lower half), not⋯ 115 unchanged lines ⋯ - **1.0.0 (2026-04-24)** — Initial publish.  When rules here are wrong — they will be, eventually — update this-file AND land the fix upstream in `gallia/viewer/`. Every 3D viewer+file AND land the fix upstream in the Adom viewer library. Every 3D viewer reads from here.--- a/README.md+++ b/README.md@@ -1,676 +1,476 @@⋯ 9 unchanged lines ⋯ fixed orbit center makes every rotation on a large assembly feel like flying blind. Everything below is either (a) a rule Claude keeps getting wrong from first principles or (b) a goodie the team already-baked into the canonical Adom Babylon viewer at `gallia/viewer/` that-deserves to be the default everywhere.---## 2. Use the canonical Adom Babylon viewer as the baseline — extend, don't fork--**The rule:** every new Adom app that needs 3D starts from the-canonical Adom Babylon viewer at `gallia/viewer/`. Not from a blank-Babylon `new Scene()`. Not from a Babylon playground snippet. Not-from a fresh `create-babylon-app`. **From the canonical viewer.**--The canonical viewer already solves — or is the right place to solve —-every problem in this skill. If you build a new viewer from scratch-for your new app, you are either (a) re-implementing what already-exists and drifting, or (b) solving it wrong and shipping regressions-the canonical viewer would have caught.--### 2a. What the canonical viewer gives you for free--Out of the box, `gallia/viewer/` ships with:--- **Babylon engine + `environmentSpecular.env` HDRI** already bundled-  (`gallia/viewer/babylon-bundle.min.js`, `viewer/js/environmentSpecular.env`).-- **ArcRotateCamera with soft limits** (§6b) and behavior strip-  (`3d.html:293`).-- **ViewCube / view presets** — front / back / left / right / top /-  bottom / isometric buttons wired to the correct Z-up-  `alpha`/`beta` angles (see §7). Click a face, camera tweens.-- **World-origin axis helper** — R/G/B X/Y/Z gizmo at (0,0,0) visible-  by default so the user can always see which way is up and where-  the scene's origin lives (see §8). Toggleable but default-on.-- **Bottom-light toggle** for PCB under-chip inspection (§4b).-- **GLB loader with Y-up → Z-up handling** (§11) and-  `applyGlbZUpTransform(viewer, glbSource)` helper.-- **Measurement tool** with vertex snapping + auto-scaled markers (§9).-- **Cinematic camera tour** (auto-play on model load, 11-phase-  choreographed reveal).-- **AI-drivability surface** — `window.Adom3DViewer` global +-  `postMessage` protocol + console forwarding (§10).-- **Shadow ground mesh** (`shadowGround`) for soft contact shadows.-- **MCP tool integration** — callable as `av_3d_display` /-  `av_basic_3d_display` from any Claude agent.--Reuse path: embed the viewer in your app, or use the Basic3dView-entry point (`gallia/viewer/3d-viewer-standalone.ts`) as your starter,-or call the MCP tool to open the viewer in Hydrogen. Pick whichever-matches your app's surface — but start from this base.--### 2b. The upstream-first workflow for new best practices--When you discover a best practice the canonical viewer is missing —-the gradient background in §3 is the flagship current example, but-so is zoom-to-mouse (§6a), orbit-center recentering (§6c), or-anything else that lands in this skill — the workflow is:--1. **Add it to the canonical viewer first.** Land a PR in-   `gallia/viewer/` that adds the feature as a baseline default.-   Include a toolbar toggle if it's opinionated.-2. **Update this skill** to reflect that the canonical viewer now-   supports it (move from "known migration debt" to "you get this-   for free").-3. **Delete workarounds** from downstream apps. If a downstream app-   copy-pasted a hack to fix the missing behavior, remove it — the-   app should inherit from the canonical viewer now.-4. **Roll out via the Adom update pipeline.** All consumers get the-   new default automatically on their next `adom update` or workspace-   refresh. No per-app migration required.--### 2c. Do NOT do any of these--- **Do not fork the viewer into your app's repo.** Forks drift. A-  feature added to the canonical viewer never makes it into your-  fork, and a bug fixed in your fork never makes it back.-- **Do not write a parallel mini-viewer** to "just show a GLB-  quickly." `Basic3dView` already exists for that use case-  (`basic-3d-viewer` skill). Use it.-- **Do not ship app-local workarounds for viewer bugs.** File them-  against `gallia/viewer/` and fix them there.-- **Do not re-implement ViewCube, measurement, HDRI loading, or-  bottom-light-toggle per-app.** Inherit from the canonical viewer.--### 2d. Current canonical-viewer debt — improve it, don't route around it--The canonical viewer predates some of the rules in this skill. As-of 2026-04-24:--- Clear color is flat near-black `Color3(0.05, 0.06, 0.08)`-  (`fp-to-3d.js:~1642`) — should be the gradient in §3. **Fix-  upstream per §2b.**-- `cam.zoomToMouseLocation` is not explicitly set on all camera-  construction paths — audit and set it on every ArcRotateCamera-  (§6a).-- Orbit-center recentering (§6c) doesn't exist yet — add as a new-  feature to the canonical viewer, not as a per-app hack.-- Mesh-local axis helpers (§8b) and the screen-space corner triad-  (§8c) don't exist yet — audit and add upstream. The world-origin-  helper (§8a) may or may not be present; verify and make it-  default-on if missing.--These are the next PRs for `gallia/viewer/`. None of them is more-than a ~20–40-line change.--### 2e. How to extend — the 5-tier layering decision matrix--"Extend, don't fork" (§2c) is the rule. **Layering** is the-implementation. There are five tiers, ordered from most-embedded-(preferred) to least-embedded (rare, last resort). Pick the highest-tier that works for your app.--#### Tier 1 — Pure embed in a Hydrogen webview or AV panel *(90%+ of apps)*--You write zero viewer code. Your app opens the canonical viewer in a-Hydrogen tab (or the AV panel), passes a GLB path + a few config-knobs, and drives it via `postMessage`. Every future improvement to-the canonical viewer (brightened gradient, axis helpers, new-toolbar buttons) shows up in your app automatically on the next-`adom update`. **Default to this tier.** Apps like shotlog,-parts-search, library-review, chipfit, 3d-component-creator, and-adom-tsci all belong here. If you're tempted to leave this tier,-prove it to yourself first by listing exactly what the canonical-viewer can't do and asking whether adding it upstream (§2b) would-serve everyone.--#### Tier 2 — MCP tool call *(simplest path)*--`av_3d_display({ glb_path, title, ... })` or-`av_basic_3d_display({ glb_path, title })` from the Claude side. No-browser code in your app at all. Use this when your "app" is-fundamentally an AI pipeline that ends in "show this to the user" —-a one-shot display, a generated preview, a datasheet render. Same-inherited behavior as Tier 1.--#### Tier 3 — Import `Basic3dView` into your own canvas host--`gallia/viewer/3d-viewer-standalone.ts` exposes-`window.Adom3DViewer.init(canvasEl, opts)`. You host the canvas in-your own DOM (for layout reasons — you want the viewer inside your-app's workspace tab instead of a separate panel), but Babylon scene-setup, HDRI, camera defaults, GLB loader, Y-up→Z-up transform, axis-helpers, pivot sphere, and bottom-light toggle are all inherited.-**This is the sweet spot when you need a 3D tab inside your app's-workspace rather than a separate panel.**--#### Tier 4 — Canonical viewer + extension hooks (plugin-style)--When you need one or two custom pieces — an app-specific toolbar-button, a custom `scene.onBeforeRender` observer, a scene-graph-annotation your app owns, a net-highlight overlay for PCB routing —-you add the *extension points* upstream first (§2b workflow), then-use them from your app. The canonical viewer becomes an extensible-host, not a closed box. If it doesn't expose the hook you need,-**land the hook upstream before your app ships.** Don't let missing-hooks push you to Tier 5 unless there's genuinely no way to-generalize them.--#### Tier 5 — Roll your own, but still Babylon, still inherit helpers *(last resort)*--Very rare. When justified, you still import `@babylonjs/core`, still-call `applyGlbZUpTransform`, `applyAdomViewportDefaults`,-`applyAdomCameraDefaults`, the axis helper functions, the-pivot-sphere wiring, the CSS gradient. Every §1–§15 rule still-applies. You're rolling your own *scene orchestration*, not your-own rendering stack.--### 2f. Three-question decision flow--1. **Is your app's 3D "view this model / scene data"?** → **Tier 1-   or 2 embed.** Stop here. If you're thinking "but I need a custom-   layout," re-ask #1 — most custom-layout needs are "I want my own-   panel chrome around a standard viewer," which is an embed with a-   styled wrapper, not a custom viewer.-2. **Does your app need the canvas inside its own DOM / workspace-   tab?** → **Tier 3 (Basic3dView import).** You still inherit-   everything; you just get to pick the canvas parent.-3. **Do you need custom scene behavior the canonical viewer can't be-   taught?** → **Tier 4.** Add the hook upstream, then use it. Only-   jump to Tier 5 if you're certain the behavior doesn't generalize.--### 2g. Signals you should NOT roll your own+baked into the canonical Adom Babylon viewer that deserves to be the+default everywhere. -- *"The canonical viewer doesn't have feature X"* → add X upstream-  (§2b). If it generalizes, everyone benefits; if it doesn't, it-  probably shouldn't be in a shared viewer anyway.-- *"I need a custom toolbar."* → the canonical viewer's toolbar can-  be extended. Add the extension point upstream if it isn't there.-- *"I need different default materials."* → set them via-  `tweak_scene` postMessage (§10b) or on init. Not a rolling reason.-- *"I want my own layout around the canvas."* → Tier 3 import lets-  you own the layout without forking the scene.-- *"Three.js has a library that does X."* → see §1. No.+> **Where the viewer lives now.** `gallia/viewer/` was removed in May 2026. Its successor is the Adom viewer library ([adom/adom-3d-viewer](https://wiki.adom.inc/adom/adom-3d-viewer)), source on GitHub `adom-inc/adom-3d-viewer-babylon9`, global `window.Adom3DViewerBabylon9`. Sections below that still name a `gallia/viewer/` file or the old `window.Adom3DViewer` API describe that retired viewer; the library's README lists the current API. -### 2h. Signals you might legitimately roll your own -- **Render-to-texture pipelines** — ML training data generation,-  simulation frames streaming, deterministic render farms. The-  canonical viewer is a UI; you need a renderer-as-service.-- **Hybrid 2D+3D canvases** with custom layout math where 3D is-  incidental (e.g. a schematic tool where 3D is a hover preview).-- **Realtime streaming / headless rendering** — WebRTC pipeline,-  cloud-rendered output, server-side render.-- **Fundamentally different rendering model** — ray tracing demo,-  Monte Carlo renderer, shader-education tool, game engine.-- **Your app's primary purpose IS 3D** in a way PCB/CAD viewing-  isn't a use case (physics sim, generative art tool). Here the-  canonical viewer is just the wrong primitive. -Even in these cases, §1 (Babylon) and the §2a helper-function-imports still apply. Don't abandon the pattern library — just the-specific entry point.+## 2. Use the Adom viewer: extend it, don't fork it -### 2i. One-line summary+Adom has one 3D viewer: the Adom viewer library (wiki page [adom/adom-3d-viewer](https://wiki.adom.inc/adom/adom-3d-viewer), Babylon 9). Pick the first option that does the job: -**Embed if you can, import if you must, roll if you're sure — and-never leave the canonical viewer's pattern library behind,-regardless of tier.**+1. **A model on a hardware page:** put the GLB on the page and the page's 3D tab shows it. Layers, intros, tooltips, switchable groups and lights come from the GLB's `extras` (the `wiki-hero-glb` skill in adom/adom-wiki-skillpack lists them); viewer options come from `component.viewer_3d` in page.json. Add no viewer of your own.+2. **A model inside a README:** the `::adom-3d` directive, for example `::adom-3d{src="/<owner>/<slug>/render/model.glb" heading="..." caption="..."}`.+3. **An app or custom page that needs more** (its own panels, animation, picking): import the library and build on it. On the wiki, load `https://wiki.adom.inc/static/vendor/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.esm.js` with no `?v=` pin, then call `Adom3DViewerBabylon9.init(host, { zUp: true })`; `await Adom3DViewerBabylon9.loadBabylon()` returns the whole Babylon engine. Inside a readme.html, follow the sandbox notes in the `wiki-readme-html` skill. A tool that ships offline pins a release instead: `adom-wiki release download adom/adom-3d-viewer <version> adom-3d-viewer-babylon9-<version>.tar.gz`. +Never copy a viewer bundle into a page or repo (`adom-3d-viewer.min.js`, or any Babylon or three.js build), and never start a new three.js, model-viewer or bare Babylon scene. If the library lacks something you need, open an issue or pull request on [adom-inc/adom-3d-viewer-babylon9](https://github.com/adom-inc/adom-3d-viewer-babylon9).  ## 4. Lighting — HDRI + hemispheric is the production default ⋯ 229 unchanged lines ⋯   orbits around the current (possibly recentered) target. Users   learn the chord; they don't have to use it. -Ship this in the canonical viewer first (§2b), delete it from any+Ship this in the library first, delete it from any downstream workaround.  ### 6d. Defaults⋯ 204 unchanged lines ⋯ - **1.0.0 (2026-04-24)** — Initial publish.  When rules here are wrong — they will be, eventually — update this-file AND land the fix upstream in `gallia/viewer/`. Every 3D viewer+file AND land the fix upstream in the Adom viewer library. Every 3D viewer reads from here.

Comments

No comments yet.

Log in to comment.