@displayxr/inline3d-tools 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -15,11 +15,11 @@ sandboxed agent, prefer the MCP server** (below): MCP servers run outside the sa
15
15
  sandbox. Otherwise run them as shell commands:
16
16
 
17
17
  ```sh
18
- npx -y @displayxr/inline3d-tools@0.1.2 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
19
- npx -y @displayxr/inline3d-tools@0.1.2 assets <file.glb> [--target tablet|desktop]
20
- npx -y @displayxr/inline3d-tools@0.1.2 assets prep <in> <out.glb> [--metres 0.01] [--decimate 0.5]
21
- npx -y @displayxr/inline3d-tools@0.1.2 scaffold <esm|vite> <target-dir> --title "<page title>"
22
- npx -y @displayxr/inline3d-tools@0.1.2 gen providers | gen run <adapter> ... --confirm-paid | gen provenance --file ...
18
+ npx -y @displayxr/inline3d-tools@0.1.3 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
19
+ npx -y @displayxr/inline3d-tools@0.1.3 assets <file.glb> [--target tablet|desktop]
20
+ npx -y @displayxr/inline3d-tools@0.1.3 assets prep <in> <out.glb> [--metres 0.01] [--decimate 0.5]
21
+ npx -y @displayxr/inline3d-tools@0.1.3 scaffold <esm|vite> <target-dir> --title "<page title>"
22
+ npx -y @displayxr/inline3d-tools@0.1.3 gen providers | gen run <adapter> ... --confirm-paid | gen provenance --file ...
23
23
  ```
24
24
 
25
25
  or, with the MCP server configured (`inline3d-tools mcp`; config snippets for Codex, Cursor and
@@ -70,8 +70,23 @@ three when the page already is a three.js app (`addScene` + `EyeCamera`, see
70
70
  and zooms): the camera moves, so it is a camera rig. Tie `convergence` to the ground at the view
71
71
  centre (raycast the centre of the screen to the ground plane), not to the cursor or a gaze point,
72
72
  and cap zoom-in so the comfort product stays ≤ 1.
73
- - Details: `docs/authoring-inline-3d.md` § View rigs. Comfort on a camera rig:
74
- `ipdFactor × metersToVirtual × convergenceDiopters × ~0.6` must stay ≤ 1; never `convergence: 0`.
73
+ - **Use most of the comfort zone: too little depth is a failure too** (near-zero disparity reads
74
+ flat). Camera-rig eyes are real eyes, `0.063 m × ipdFactor × metersToVirtual` apart (world units
75
+ per real metre). Rule:
76
+ 1. `convergence` = camera to centre of interest; the subject straddles the glass.
77
+ 2. Never rescale your world; set `metersToVirtual`: true scale (metres, cm, ported VR) → the true
78
+ conversion (1, 100); no true scale (most games) → `convergence / 2` in your units (subject at
79
+ 2 m; 13.4 → 6.7). If zoom changes the distance a lot, re-set it per frame in `setViewRig`.
80
+ 3. `ipdFactor` tunes depth: ≈ 1 for an open scene (to the horizon); bounded (board, room, track):
81
+ 0.8–1× of `cameraRigComfortFactor({ zNear, zFar, convergence, verticalFov, aspect, tileHeightM,
82
+ viewerM, ipdFactor, metersToVirtual })` (`@displayxr/inline3d/depth`; fills the zone; often 1.5–2.5).
83
+ `parallaxFactor` = `ipdFactor`; perspective, tilted camera; never `convergence: 0`. Comfort
84
+ `ipdFactor × metersToVirtual × convergenceDiopters × N` ≤ 1 (N = `nominalViewerPosition.z`, else
85
+ 0.6 m) is the ceiling for content at infinity, not a target. Example: 13.4 units out, `ipdFactor: 2.5`, `metersToVirtual: 1`
86
+ uses ~20% of the zone, flat; rule: `metersToVirtual: 6.7`, `ipdFactor` ≈ 1.4–1.7.
87
+ - **Display rig:** `ipdFactor`/`parallaxFactor` 1 = natural, full roundness; don't lower without a reason.
88
+ - Budgets are reports, not limits to stay far inside: never lower depth as the user zooms.
89
+ Details: `docs/authoring-inline-3d.md` § Aim for real depth.
75
90
 
76
91
  ### 3. Depth and comfort (`docs/making-3d-look-right.md`, nine rules)
77
92
 
@@ -151,8 +166,8 @@ world per frame. Shrinking depth: rotate or scale uniformly, never squash z.
151
166
 
152
167
  ### 6. Pins (exact versions, no `^`)
153
168
 
154
- `@displayxr/inline3d` **1.52.3**, `playcanvas` **2.24.0** (exact; `>=2.22.3 <3` is the supported
155
- range), `three` **0.180.0**. CDN import maps pin the same: `https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.52.3/js/inline3d.js`,
169
+ `@displayxr/inline3d` **1.56.1**, `playcanvas` **2.24.0** (exact; `>=2.22.3 <3` is the supported
170
+ range), `three` **0.180.0**. CDN import maps pin the same: `https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.56.1/js/inline3d.js`,
156
171
  `https://cdn.jsdelivr.net/npm/playcanvas@2.24.0/build/playcanvas.mjs`,
157
172
  `https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.js`. If a newer SDK is installed, its
158
173
  `CHANGELOG.md` says what changed; prefer the installed version's docs over this list.
@@ -160,7 +175,7 @@ range), `three` **0.180.0**. CDN import maps pin the same: `https://cdn.jsdelivr
160
175
  ### 7. Before you say done: run the checker
161
176
 
162
177
  ```sh
163
- npx -y @displayxr/inline3d-tools@0.1.2 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
178
+ npx -y @displayxr/inline3d-tools@0.1.3 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
164
179
  ```
165
180
 
166
181
  This runs the exact-pinned `@displayxr/inline3d-tools` package from npm (the first run downloads it;
@@ -188,8 +203,8 @@ The templates ship in the exact-pinned `@displayxr/inline3d-tools` npm package;
188
203
  command copies them (the first run downloads the package; the user may be asked to approve the command):
189
204
 
190
205
  ```sh
191
- npx -y @displayxr/inline3d-tools@0.1.2 scaffold esm <target-dir> --title "<page title>"
192
- npx -y @displayxr/inline3d-tools@0.1.2 scaffold vite <target-dir> --title "<page title>" [--name <npm-name>]
206
+ npx -y @displayxr/inline3d-tools@0.1.3 scaffold esm <target-dir> --title "<page title>"
207
+ npx -y @displayxr/inline3d-tools@0.1.3 scaffold vite <target-dir> --title "<page title>" [--name <npm-name>]
193
208
  ```
194
209
 
195
210
  It never overwrites an existing file (`--force` replaces). What it writes:
@@ -199,7 +214,7 @@ It never overwrites an existing file (`--force` replaces). What it writes:
199
214
  | `app.js` | the page logic (shared by both flavours): a three.js scene on `addScene` with `EyeCamera`, display rig, validate-before-clear with last-good replay, buffer sized 2× the box (dpr ≤ 2, clamped to the GPU), cover removed on `handle.firstWoven` + a 4 s timeout + `catch`, a mono 2D fallback |
200
215
  | `style.css` | page styles; the canvas and its ancestors carry no CSS effects |
201
216
  | `index.html` (esm) | no build step: an import map with exact CDN pins |
202
- | `index.html` + `package.json` (vite) | Vite: exact npm pins (`@displayxr/inline3d` 1.52.3, `three` 0.180.0) |
217
+ | `index.html` + `package.json` (vite) | Vite: exact npm pins (`@displayxr/inline3d` 1.56.1, `three` 0.180.0) |
203
218
 
204
219
  ### Steps
205
220
 
@@ -230,18 +245,19 @@ It never overwrites an existing file (`--force` replaces). What it writes:
230
245
  without `player.firstWoven`, wait for the first frame and then ~1200 ms more.
231
246
 
232
247
  Add `"playcanvas": "https://cdn.jsdelivr.net/npm/playcanvas@2.24.0/build/playcanvas.mjs"` and
233
- `"@displayxr/inline3d/model": "https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.52.3/js/inline3d-model-entry.js"`
248
+ `"@displayxr/inline3d/model": "https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.56.1/js/inline3d-model-entry.js"`
234
249
  (or `.../js/inline3d-splat-pc-entry.js` for `/splat/playcanvas`) to the import map, or
235
250
  `"playcanvas": "2.24.0"` to `package.json`. Images and video use `wall.addImage(canvas, 'pic_2x1.jpg')`
236
251
  / `wall.addVideo(canvas, videoEl)` in the 3D branch and an `<img>` of the left half (or a mono
237
252
  video) in the 2D branch. Check each export against the installed `.d.ts` before using it.
253
+ A camera-rig world or game: set its depth by the rule in "Building on @displayxr/inline3d" §2.
238
254
  4. Run it: esm → serve the directory (`python3 -m http.server`), or let the checker
239
255
  serve it; vite → `npm install && npm run dev`.
240
256
  5. **Run the checker before saying done**, and fix every FAIL:
241
257
 
242
258
  ```sh
243
- npx -y @displayxr/inline3d-tools@0.1.2 check <target-dir> # esm
244
- npx -y @displayxr/inline3d-tools@0.1.2 check http://localhost:5173/ # vite dev server
259
+ npx -y @displayxr/inline3d-tools@0.1.3 check <target-dir> # esm
260
+ npx -y @displayxr/inline3d-tools@0.1.3 check http://localhost:5173/ # vite dev server
245
261
  ```
246
262
 
247
263
  The untouched template passes every check (verdict PASS). If your change makes a check fail, the
@@ -258,17 +274,17 @@ Tools, in the order to reach for them:
258
274
 
259
275
  | Tool | When | Install |
260
276
  |---|---|---|
261
- | `inline3d-tools assets` | always, last | `npx -y @displayxr/inline3d-tools@0.1.2 assets` (exact pin, from npm; Node only) |
277
+ | `inline3d-tools assets` | always, last | `npx -y @displayxr/inline3d-tools@0.1.3 assets` (exact pin, from npm; Node only) |
262
278
  | glTF-Transform CLI | glTF/GLB in, glTF/GLB out: inspect, resize, compress, simplify, centre | `npx -y @gltf-transform/cli@4.3.0` (pinned; nothing installed globally) |
263
279
  | Blender (headless) | any other format (FBX, OBJ, STL, PLY, DAE, .blend), units/axis fixes, heavy decimation | **only if already installed**; never install it |
264
- | `inline3d-tools gen` | no asset exists and the user wants one generated | `npx -y @displayxr/inline3d-tools@0.1.2 gen`; needs the user's own API key in the environment; every call is paid and needs the user's yes |
280
+ | `inline3d-tools gen` | no asset exists and the user wants one generated | `npx -y @displayxr/inline3d-tools@0.1.3 gen`; needs the user's own API key in the environment; every call is paid and needs the user's yes |
265
281
 
266
282
  ### 1. Get it
267
283
 
268
284
  In order of preference:
269
285
 
270
286
  1. **The user's own asset** (in the project, or a path they gave). Record it:
271
- `npx -y @displayxr/inline3d-tools@0.1.2 gen provenance --file assets/x.glb --source "supplied by the user" --license "user's"`.
287
+ `npx -y @displayxr/inline3d-tools@0.1.3 gen provenance --file assets/x.glb --source "supplied by the user" --license "user's"`.
272
288
  2. **A library asset with a clear licence** (CC0 / CC-BY, e.g. the Khronos glTF sample models,
273
289
  Poly Haven). Record the URL, author and licence; CC-BY needs visible credit on the page.
274
290
  3. **A placeholder you build** (primitives in three.js/PlayCanvas) when nothing fits and the user
@@ -298,7 +314,7 @@ fetches decoders from a CDN). Other fixes: `$GT simplify in.glb out.glb --ratio
298
314
  **Anything else (Blender, if present).** Detect it, don't install it:
299
315
 
300
316
  ```sh
301
- npx -y @displayxr/inline3d-tools@0.1.2 assets prep in.fbx out.glb [--metres 0.01] [--decimate 0.5] [--blender <path>]
317
+ npx -y @displayxr/inline3d-tools@0.1.3 assets prep in.fbx out.glb [--metres 0.01] [--decimate 0.5] [--blender <path>]
302
318
  ```
303
319
 
304
320
  It looks for Blender (`--blender`, `$BLENDER`, `PATH`, the default install location), never installs
@@ -314,8 +330,8 @@ helmet is ~0.3 m, not 2 m).
314
330
  ### 3. Check it (before the page uses it)
315
331
 
316
332
  ```sh
317
- npx -y @displayxr/inline3d-tools@0.1.2 assets out.glb # tablet budget (default)
318
- npx -y @displayxr/inline3d-tools@0.1.2 assets out.glb --target desktop
333
+ npx -y @displayxr/inline3d-tools@0.1.3 assets out.glb # tablet budget (default)
334
+ npx -y @displayxr/inline3d-tools@0.1.3 assets out.glb --target desktop
319
335
  ```
320
336
 
321
337
  It reports: missing external files, decoders the page must provide, triangles (both eyes draw
@@ -329,7 +345,7 @@ animations. Fix every FAIL; act on WARNs or say why not. Then run the page check
329
345
  ### 4. Generate it (optional, paid, the user's keys)
330
346
 
331
347
  ```sh
332
- npx -y @displayxr/inline3d-tools@0.1.2 gen providers # which adapters have a key (names only)
348
+ npx -y @displayxr/inline3d-tools@0.1.3 gen providers # which adapters have a key (names only)
333
349
  ```
334
350
 
335
351
  Adapters: `meshy` and `tripo` (text-to-3d, image-to-3d → GLB), `openai` (image → PNG, for
@@ -350,7 +366,7 @@ textures, posters and backdrops). Each reads its key from the environment (`MESH
350
366
  shippable.
351
367
 
352
368
  ```sh
353
- npx -y @displayxr/inline3d-tools@0.1.2 gen run meshy --kind text-to-3d --prompt "a brass desk lamp, PBR" --out assets/lamp-raw.glb --confirm-paid
369
+ npx -y @displayxr/inline3d-tools@0.1.3 gen run meshy --kind text-to-3d --prompt "a brass desk lamp, PBR" --out assets/lamp-raw.glb --confirm-paid
354
370
  ```
355
371
 
356
372
  ### 5. ASSETS.md
package/README.md CHANGED
@@ -9,7 +9,7 @@ same operations. [`AGENTS.md`](AGENTS.md) is the matching authoring checklist fo
9
9
  Needs Node ≥ 18. `check` also needs a local Chrome or Chromium. Always run an **exact version**:
10
10
 
11
11
  ```sh
12
- npx -y @displayxr/inline3d-tools@0.1.2 <command> ...
12
+ npx -y @displayxr/inline3d-tools@0.1.3 <command> ...
13
13
  ```
14
14
 
15
15
  ## CLI
@@ -47,7 +47,7 @@ environment only and are redacted from every tool result.
47
47
  ### Claude Code
48
48
 
49
49
  ```sh
50
- claude mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.2 mcp
50
+ claude mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.3 mcp
51
51
  ```
52
52
 
53
53
  or in a project's `.mcp.json`:
@@ -57,7 +57,7 @@ or in a project's `.mcp.json`:
57
57
  "mcpServers": {
58
58
  "inline3d-tools": {
59
59
  "command": "npx",
60
- "args": ["-y", "@displayxr/inline3d-tools@0.1.2", "mcp"]
60
+ "args": ["-y", "@displayxr/inline3d-tools@0.1.3", "mcp"]
61
61
  }
62
62
  }
63
63
  }
@@ -77,7 +77,7 @@ needs you to approve running it outside the sandbox. In `~/.codex/config.toml` (
77
77
  ```toml
78
78
  [mcp_servers.inline3d-tools]
79
79
  command = "npx"
80
- args = ["-y", "@displayxr/inline3d-tools@0.1.2", "mcp"]
80
+ args = ["-y", "@displayxr/inline3d-tools@0.1.3", "mcp"]
81
81
  # cwd = "/path/to/your/project" # relative paths in tool calls resolve here
82
82
  startup_timeout_sec = 30 # first run downloads the package (default 10)
83
83
  tool_timeout_sec = 180 # a page check takes 10-60 s; generation can take minutes (default 60)
@@ -85,11 +85,11 @@ tool_timeout_sec = 180 # a page check takes 10-60 s; generation can t
85
85
  # env_vars = ["MESHY_API_KEY", "TRIPO_API_KEY", "OPENAI_API_KEY"]
86
86
  ```
87
87
 
88
- or `codex mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.2 mcp`. The
88
+ or `codex mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.3 mcp`. The
89
89
  [`displayxr-inline3d-codex` plugin](https://github.com/DisplayXR/displayxr-web/tree/main/plugins/displayxr-inline3d-codex)
90
90
  sets the server up for you in Codex.
91
91
 
92
- **Fetch the package once before the first Codex session:** `npx -y @displayxr/inline3d-tools@0.1.2 --version`.
92
+ **Fetch the package once before the first Codex session:** `npx -y @displayxr/inline3d-tools@0.1.3 --version`.
93
93
  Codex starts MCP servers when a session starts and can stop one before a cold `npx` download
94
94
  finishes. The interrupted download leaves a broken entry in npm's `_npx` cache (`node_modules`
95
95
  without a `package.json`), and from then on the server fails at every start with
@@ -109,7 +109,7 @@ In `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):
109
109
  "mcpServers": {
110
110
  "inline3d-tools": {
111
111
  "command": "npx",
112
- "args": ["-y", "@displayxr/inline3d-tools@0.1.2", "mcp"]
112
+ "args": ["-y", "@displayxr/inline3d-tools@0.1.3", "mcp"]
113
113
  }
114
114
  }
115
115
  }
@@ -151,7 +151,7 @@ forwarding). Never paste a key into an agent chat.
151
151
  ## check
152
152
 
153
153
  ```sh
154
- npx -y @displayxr/inline3d-tools@0.1.2 check <url | dir | page.html> [--root <dir>] [--max-texture 4096] [--json] [--out report.json]
154
+ npx -y @displayxr/inline3d-tools@0.1.3 check <url | dir | page.html> [--root <dir>] [--max-texture 4096] [--json] [--out report.json]
155
155
  ```
156
156
 
157
157
  Needs Node ≥ 18 and a local Chrome (`CHROME=/path/to/chrome` overrides the default location). It
@@ -183,9 +183,10 @@ disparity, so the checker can measure depth in millimetres of screen disparity.
183
183
  | `detection` | runtime `isSessionSupported('inline-3d')` calls; static scan of same-origin scripts for it and for UA sniffing next to "DisplayXR" | approximate |
184
184
  | `pins` | import-map CDN URLs and `package.json` versions for the SDK, playcanvas and three are exact | approximate |
185
185
  | `depth` | block-matched disparity of the primary canvas, in mm of screen disparity, against the Shibata comfort zone at 0.65 m; subject entirely off the glass | approximate |
186
+ | `depth-underused` | too little depth is a failure too (a report, never a limit), 0.1.3. **Camera rig: measured** from the two eye images: the share of the Shibata comfort zone (0.65 m) the default view uses, on its binding side (`max(|p05| / front, p95 / behind)` of the block disparities, mm on the glass; `cameraRigComfortFactor` ≈ 1 / that share). Below 30 % is a WARN; a rig converged at infinity WARNs too. The hint gives the rule: convergence on the centre of interest, `metersToVirtual` = the true conversion or `convergence / 2` (no true scale), then `ipdFactor` ≈ 1 (open scene) or 0.8–1× `cameraRigComfortFactor` (bounded). **Display rig: from the rig** (its natural depth is the subject's real proportions, so the measured span is not judged): `ipdFactor` below 0.5 is a WARN (0 = 2D on purpose) | camera: approximate; display: real |
186
187
 
187
188
  Also reported: the rig (display/camera and its fields) and, for a camera rig, the comfort number
188
- `ipdFactor × metersToVirtual × convergenceDiopters × 0.65`.
189
+ `ipdFactor × metersToVirtual × convergenceDiopters × 0.65` (the divergence ceiling: keep ≤ 1).
189
190
 
190
191
  **Blind spots.** It is not a panel: no weave, no real compositor join, no eye tracking, no crosstalk.
191
192
  Views come from the most recently created layer, so a page with several tiles on different rigs is
@@ -194,7 +194,11 @@ export function flatWideVerdict(buf) {
194
194
  const fwd = blockDisparity(L, R), back = blockDisparity(R, L);
195
195
  const textured = fwd.textured + back.textured;
196
196
  const matchRatio = textured ? (fwd.length + back.length) / textured : 1;
197
- const sameScene = cmp.identical || (cmp.madBest < Math.max(3, 0.35 * cmp.baseline) && (textured < 8 || matchRatio >= 0.35));
197
+ // A scene with real depth has no ONE shift that explains it (near and far content move apart),
198
+ // so strong local evidence on its own (most textured blocks of both halves matched) also counts.
199
+ const sameScene = cmp.identical
200
+ || (cmp.madBest < Math.max(3, 0.35 * cmp.baseline) && (textured < 8 || matchRatio >= 0.35))
201
+ || (textured >= 8 && matchRatio >= 0.6);
198
202
  // The seam is evidence, not a gate: on a mostly uniform background the "typical" column step is
199
203
  // ~0 and any content crossing the middle looks like a break. Two halves that no shift within
200
204
  // ±12 % of the eye width explains are not a stereo pair a display could fuse either way.
@@ -242,3 +246,74 @@ export function regionDiff(A, B) {
242
246
  for (let i = 0; i < a.length; i++) t += Math.abs(a[i] - b[i]);
243
247
  return t / a.length;
244
248
  }
249
+
250
+ /** depth-underused: a camera rig using less than this share of the comfort zone WARNs (= cameraRigComfortFactor above ~3.3). */
251
+ export const DEPTH_ZONE_USE_FLOOR = 0.3;
252
+ /** depth-underused: a display rig with ipdFactor below this (and above 0, which is 2D on purpose) WARNs. */
253
+ export const DISPLAY_IPD_UNDERUSED = 0.5;
254
+
255
+ /**
256
+ * Is the page using the depth the display can show? A report, never a limit.
257
+ *
258
+ * - Camera rig: MEASURED. `measured` = on-glass disparities (mm, signed, < 0 in front) of the
259
+ * textured blocks of the captured default view. Share of the zone used = the binding side,
260
+ * max(|p05| / zone.frontMm, p95 / zone.behindMm) (the side cameraRigComfortFactor binds on; its
261
+ * factor is 1 / this share). WARN below DEPTH_ZONE_USE_FLOOR: near-zero disparity is a defect.
262
+ * A rig converged at infinity WARNs from the rig alone.
263
+ * - Display rig: from the RIG. ipdFactor / parallaxFactor 1 are the natural depth (full roundness at
264
+ * real proportions), so a shallow measured span is not judged; ipdFactor below 0.5 WARNs.
265
+ * @returns {{status: 'pass'|'warn'|'skip', summary: string, hint?: string, details: object|null}}
266
+ */
267
+ export function rigDepthUse(rig, measured, zone) {
268
+ if (rig === undefined) return { status: 'skip', summary: 'no woven layer: no view rig to read', details: null };
269
+ if (!rig || rig.type !== 'camera') {
270
+ const ipd = rig && typeof rig.ipdFactor === 'number' ? rig.ipdFactor : 1;
271
+ const details = { type: 'display', ipdFactor: ipd };
272
+ if (ipd === 0) return { status: 'pass', summary: 'display rig at ipdFactor 0: 2D on purpose', details };
273
+ if (ipd < DISPLAY_IPD_UNDERUSED) {
274
+ return {
275
+ status: 'warn',
276
+ summary: `display rig ipdFactor ${+ipd.toFixed(3)}: below ${DISPLAY_IPD_UNDERUSED}, the subject is drawn at under half its natural depth and reads flat`,
277
+ hint: 'On a display rig ipdFactor and parallaxFactor 1 are the natural depth (full roundness at real proportions): keep them at 1 unless you can name the reason. Too little depth is a failure too.',
278
+ details,
279
+ };
280
+ }
281
+ return { status: 'pass', summary: `display rig at ipdFactor ${+ipd.toFixed(3)} (1 = natural depth)`, details };
282
+ }
283
+ const ipd = typeof rig.ipdFactor === 'number' ? rig.ipdFactor : 1;
284
+ const m2v = rig.metersToVirtual || 1;
285
+ const dio = typeof rig.convergenceDiopters === 'number' ? rig.convergenceDiopters : 0;
286
+ const details = { type: 'camera', ipdFactor: ipd, metersToVirtual: m2v, convergenceDiopters: dio };
287
+ if (ipd === 0) return { status: 'pass', summary: 'camera rig at ipdFactor 0: 2D on purpose', details };
288
+ if (!(dio > 0)) {
289
+ return {
290
+ status: 'warn',
291
+ summary: 'camera rig converged at infinity (convergenceDiopters 0): the whole scene sits in front of the glass',
292
+ hint: 'Converge on the centre of interest (convergence = its distance from the camera), so the subject straddles the glass; then metersToVirtual = the true conversion, or convergence / 2 for a world with no true scale, and ipdFactor ≈ 1 (more for a bounded scene, via cameraRigComfortFactor).',
293
+ details,
294
+ };
295
+ }
296
+ if (!measured || measured.length < 8 || !zone) {
297
+ return { status: 'skip', summary: 'camera rig: too few textured blocks to measure its disparity', details };
298
+ }
299
+ const D = 1 / dio;
300
+ const front = Math.max(0, -quantile(measured, 0.05)), back = Math.max(0, quantile(measured, 0.95));
301
+ const use = Math.max(front / zone.frontMm, isFinite(zone.behindMm) ? back / zone.behindMm : 0);
302
+ const normM2v = D / 2; // rule 2: the centre of interest declared 2 real metres away
303
+ const normIpd = (ipd * m2v) / normM2v; // this rig's eye separation on that scale
304
+ Object.assign(details, {
305
+ zoneUsed: +use.toFixed(3), floor: DEPTH_ZONE_USE_FLOOR, frontMm: +front.toFixed(2), behindMm: +back.toFixed(2),
306
+ zoneMm: { front: +zone.frontMm.toFixed(1), behind: +zone.behindMm.toFixed(1) },
307
+ normalisedMetersToVirtual: +normM2v.toPrecision(3), ipdFactorOnThatScale: +normIpd.toPrecision(3),
308
+ fillMultiplier: use > 0 ? +(1 / use).toPrecision(3) : null,
309
+ });
310
+ if (use < DEPTH_ZONE_USE_FLOOR) {
311
+ return {
312
+ status: 'warn',
313
+ summary: `the scene uses ${Math.round(use * 100)}% of the comfort zone at the default view (measured: ${front.toFixed(1)} mm in front, ${back.toFixed(1)} mm behind the glass): it reads nearly flat`,
314
+ hint: `Camera-rig rule: (1) convergence = the distance to the centre of interest (here ${+D.toPrecision(3)}), so the subject straddles the glass; (2) never rescale the world, set metersToVirtual: the true conversion if the world has a true scale (metres 1, centimetres 100), else convergence / 2 = ${details.normalisedMetersToVirtual} (the subject declared 2 m away; this rig is ipdFactor ${details.ipdFactorOnThatScale} on that scale), re-set per frame if the camera zooms a lot; (3) ipdFactor tunes depth: ≈ 1 for an open scene, more for a bounded one (typically 1.5–2.5): 0.8–1× of cameraRigComfortFactor({ zNear, zFar, convergence, verticalFov, aspect, tileHeightM, viewerM, ipdFactor, metersToVirtual }) from @displayxr/inline3d/depth. Disparity scales with ipdFactor${details.fillMultiplier ? `: ×${details.fillMultiplier} would fill the zone here` : ''}. Keep parallaxFactor with it.`,
315
+ details,
316
+ };
317
+ }
318
+ return { status: 'pass', summary: `the scene uses ${Math.round(use * 100)}% of the comfort zone at the default view (${front.toFixed(1)} mm in front, ${back.toFixed(1)} mm behind)`, details };
319
+ }
@@ -422,6 +422,7 @@
422
422
  ageMs: now() - r.createdAt,
423
423
  init: r.init,
424
424
  rig: r.layer.rig ? safeClone(r.layer.rig) : null,
425
+ firstRig: r.rigs.length ? r.rigs[0] : null, // the rig at the default view (before any user input)
425
426
  rigPushes: r.rigPushes,
426
427
  sameCanvasLiveAtCreate: r.sameCanvasLiveAtCreate,
427
428
  coverAtCreate: r.coverAtCreate,
package/lib/check/run.mjs CHANGED
@@ -7,7 +7,7 @@ import { launchChrome, withTimeout } from './cdp.mjs';
7
7
  import { serveDir } from './server.mjs';
8
8
  import { decodePng } from './png.mjs';
9
9
  import {
10
- crop, halves, contentStats, regionDiff, compareEyes, blockDisparity, quantile, flatWideVerdict, sbsPairVerdict, shibataZoneMm, fromBase64Rgba,
10
+ crop, halves, contentStats, regionDiff, compareEyes, blockDisparity, quantile, flatWideVerdict, sbsPairVerdict, shibataZoneMm, fromBase64Rgba, rigDepthUse,
11
11
  } from './analyze.mjs';
12
12
 
13
13
  const HERE = dirname(fileURLToPath(import.meta.url));
@@ -742,13 +742,15 @@ function buildChecks(fake, plain, opt) {
742
742
  }
743
743
 
744
744
  // depth / comfort (measured)
745
+ const zone = shibataZoneMm(0.65);
746
+ let measuredMm = null; // on-glass disparity per textured block of the primary canvas, mm, signed
745
747
  {
746
748
  let status = 'skip', summary = 'no stereo pair to measure';
747
749
  let details = null;
748
- const zone = shibataZoneMm(0.65);
749
750
  if (primary && primary.px && primary.px.blocks.length >= 3 && primary.occlusion) {
750
751
  const k = (primary.occlusion.rect.width / primary.px.eyeW) * MPP * 1000; // mm per eye px
751
752
  const ds = primary.px.blocks.map((b) => b.d * k);
753
+ measuredMm = ds;
752
754
  const p05 = quantile(ds, 0.05), p50 = quantile(ds, 0.5), p95 = quantile(ds, 0.95);
753
755
  details = { frontMostMm: +p05.toFixed(2), medianMm: +p50.toFixed(2), backMostMm: +p95.toFixed(2), comfortZoneMm: { front: +zone.frontMm.toFixed(1), behind: +zone.behindMm.toFixed(1) }, blocks: ds.length, sign: '- = in front of the glass, + = behind' };
754
756
  const warns = [];
@@ -761,6 +763,19 @@ function buildChecks(fake, plain, opt) {
761
763
  }
762
764
  checks.push(check('depth', '-', 'Depth sits on the glass and inside the comfort zone (measured, approximate)', status, summary, { details, approximate: true, doc: `${DOCS}/making-3d-look-right.md` }));
763
765
  }
766
+
767
+ // depth used: too little depth is a failure too. A report, never a limit. Camera rig: the measured
768
+ // disparity of the captured (default, no-input) view against a floor; display rig: its ipdFactor.
769
+ {
770
+ const rig = primary ? (primary.firstRig !== undefined ? primary.firstRig : primary.rig) : undefined;
771
+ const r = rigDepthUse(rig, measuredMm, zone);
772
+ checks.push(check('depth-underused', '-', 'The scene uses the depth the display can show (camera rig: at least ~30% of the comfort zone, measured; display rig: ipdFactor near 1)', r.status, r.summary, {
773
+ details: r.details,
774
+ hint: r.hint,
775
+ approximate: !!(rig && rig.type === 'camera'),
776
+ doc: `${DOCS}/authoring-inline-3d.md#aim-for-real-depth`,
777
+ }));
778
+ }
764
779
  return checks;
765
780
  }
766
781
 
@@ -776,7 +791,7 @@ function rigInfo(fake) {
776
791
  const m2v = rig.metersToVirtual || 1;
777
792
  const dio = typeof rig.convergenceDiopters === 'number' ? rig.convergenceDiopters : 0;
778
793
  out.comfort = +(ipd * m2v * dio * 0.65).toFixed(3);
779
- out.comfortNote = 'ipdFactor x metersToVirtual x convergenceDiopters x 0.65 m (nominal viewer); keep <= 1';
794
+ out.comfortNote = 'ipdFactor x metersToVirtual x convergenceDiopters x 0.65 m (nominal viewer); the divergence ceiling, keep <= 1';
780
795
  } else {
781
796
  out.comfort = null;
782
797
  out.comfortNote = 'display rig: ipdFactor/parallaxFactor are relative comfort dials in [0,1]';
@@ -858,7 +873,7 @@ export function formatHuman(r) {
858
873
  if ((c.status === 'fail' || c.status === 'warn') && c.doc) lines.push(` see: ${c.doc}`);
859
874
  }
860
875
  const rig = r.info.rig;
861
- lines.push(` rig: ${rig.type || 'n/a'}${rig.type === 'camera' ? `, comfort ${rig.comfort} (keep <= 1)` : ''}${rig.virtualDisplayHeight ? `, virtualDisplayHeight ${rig.virtualDisplayHeight}` : ''}`);
876
+ lines.push(` rig: ${rig.type || 'n/a'}${rig.type === 'camera' ? `, comfort ${rig.comfort} (ceiling 1)` : ''}${rig.virtualDisplayHeight ? `, virtualDisplayHeight ${rig.virtualDisplayHeight}` : ''}`);
862
877
  lines.push(` verdict: ${r.verdict.toUpperCase()} in ${(r.durationMs / 1000).toFixed(1)} s`);
863
878
  return lines.join('\n');
864
879
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@displayxr/inline3d-tools",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Agent-agnostic tools for @displayxr/inline3d pages: a headless checker (fake DisplayXR Browser + plain 2D run), a glTF/GLB asset check, page scaffolds, optional asset generation with provenance, and a stdio MCP server exposing the same operations.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,8 +10,8 @@
10
10
  { "imports": {
11
11
  "three": "https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.js",
12
12
  "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.180.0/examples/jsm/",
13
- "@displayxr/inline3d": "https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.52.3/js/inline3d.js",
14
- "@displayxr/inline3d/three": "https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.52.3/js/inline3d-three.js"
13
+ "@displayxr/inline3d": "https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.56.1/js/inline3d.js",
14
+ "@displayxr/inline3d/three": "https://cdn.jsdelivr.net/npm/@displayxr/inline3d@1.56.1/js/inline3d-three.js"
15
15
  } }
16
16
  </script>
17
17
  </head>
@@ -9,7 +9,7 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@displayxr/inline3d": "1.52.3",
12
+ "@displayxr/inline3d": "1.56.1",
13
13
  "three": "0.180.0"
14
14
  },
15
15
  "devDependencies": {