topotopo 0.5.2 → 0.5.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/dist/cli.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // node src/cli.ts <graph.json> [--node name | --output name] [--var name=value]… [--frame N | --frames A-B[:step]] [--fps 24]
4
4
  // [--render out.png] [--views quad|quad_uv|turntable|persp|front_left|front,top|persp,uv|persp,section] [--checker] [--color-by attr]
5
5
  // [--wireframe all|hard|boundary|groups] [--section y:0.5] [--clip x:0.5] [--glyphs N|up|orient|v] [--labels groups,pieces,points,prims,attrib:name]
6
- // [--shading flat|matcap|ao|pbr] [--exposure 0] [--legend] [--size 800|1600x600] [--render-scale 2] [--heightfield-res 256|full]
6
+ // [--shading flat|matcap|ao|pbr] [--exposure 0] [--cd auto|ignore|multiply] [--grey] [--legend] [--size 800|1600x600] [--render-scale 2] [--heightfield-res 256|full]
7
7
  // [--transparent] [--no-grid] [--underlay ref.png [--underlay-opacity 0.5] [--underlay-fit bounds|width|height|view]] [--sockets]
8
8
  // [--heightfield-layer mask|<layer>|none] [--export out.glb]
9
9
  // [--compress meshopt] [--quantize] [--tangents auto|preserve|none] [--pcg | --pcg-struct] [--attributes P,N,pscale] [--up-axis z] [--scale 100]
@@ -45,8 +45,9 @@
45
45
  // node src/cli.ts update owner/name [folder] [--to 1.4] [--render <folder>]
46
46
  // node src/cli.ts update owner/name [folder] --from 1.3 --to 1.4 --apply
47
47
  // A graph-file cook adds a package its graph names for the first time (and says so); --locked fails instead, for a
48
- // build machine. --follow owner/name on a cook or view uses a package's working folder instead of its copy, for
49
- // looking: exports use the published copy.
48
+ // build machine. --follow owner/name on a cook or view uses a package's working folder instead of its copy; a
49
+ // graph-file cook's exports use it too (their source record says so under "followed"), but with --locked, which
50
+ // exports published versions alone. The viewer's exports use the published copy.
50
51
  // A package's published outputs cooked into a Godot project, and the Godot plugin (src/host/godot.ts, src/host/cook.ts;
51
52
  // integrations/godot/PROTOCOL.md):
52
53
  // node src/cli.ts cook <.topo | package folder | folder>... --for godot [--into <folder>] [--flat] [--skip a,b] [--instancing packed|expand] [--adopt] [--force] [--no-cache] [--timeout <s>] [--report <file>] [--progress json] [--quiet]
@@ -112,11 +113,13 @@ if (!argv.length || argv.includes('-h') || argv.includes('--help')) {
112
113
  ' [--export-all] (every output with an export target in the graph, into exports/ of its package folder)',
113
114
  ' relative paths in the graph (file nodes, maps) read from its package folder: the nearest folder with a .topo file at or',
114
115
  ' above the graph file, else the graph file\'s folder; --render/--export/--underlay paths are relative to the current folder',
115
- ' [--follow owner/name] (show that package\'s working folder, where the package finds it, instead of its copy, for this run: renders and inspect use it, exports the published copy; repeat it)',
116
- ' [--locked] (a build machine: a package the graph names that the package does not use, or a copy missing or edited by hand, fails the run instead of being added)',
116
+ ' [--follow owner/name] (use that package\'s working folder, where the package finds it, instead of its copy, for this run: renders, inspect and exports use it, unpublished (the export\'s source record lists it under "followed"); repeat it)',
117
+ ' [--locked] (a build machine: a package the graph names that the package does not use, or a copy missing or edited by hand, fails the run instead of being added; exports use the published copies, whatever --follow shows)',
117
118
  ' render overlays: [--wireframe all|hard|boundary|groups] [--hard-angle 30] [--section y:0.5] [--clip x:0.5[:abs]]',
118
119
  ' [--glyphs N|up|orient|v] [--glyph-attrib a] [--labels groups,pieces,points,prims,attrib:name] [--legend] [--points]',
119
120
  ' [--shading flat|matcap|ao|pbr] [--exposure 0] [--size 800|1600x600] [--render-scale 2]',
121
+ ' [--cd auto|ignore|multiply] (shading pbr: auto = a named material wins over Cd, Cd colours prims without one; multiply = Cd tints the material too)',
122
+ ' [--grey] (value check: pbr with every base colour a neutral 18% grey; roughness, metallic and normal maps still apply)',
120
123
  ' views: persp front back left right top bottom front_left front_right back_left back_right uv section texture persp@<az>',
121
124
  ' framing: every 3D view fits the bounds; [--zoom 1] is relative to that fit (above 1 only with --look-at or --ortho-scale)',
122
125
  ' [--azimuth 35] (degrees around +Y: 0 = camera on +Z at the front, 90 = on +X, the right side) [--elevation 25] (degrees above the horizon)',
@@ -334,18 +337,35 @@ async function cook() {
334
337
  console.log(n);
335
338
  for (const p of pk.check())
336
339
  console.error(`warning: ${p}`);
337
- for (const f of pk.following())
338
- console.log(`following ${f.package}: its working folder ${f.dir} instead of its copy, for renders and inspect (exports use the published copy)`);
339
- // the packages shown live (--follow, a workspace that follows its own) are for looking: an export cooks with their
340
- // published copies (a cook of its own when the graph names one) and says so
341
- const exportNote = pk.publishedNote(graph);
342
- const exportScope = exportNote ? pk.published() : null;
340
+ // --follow names the working folders exports use too (their source record lists them under "followed"); --locked
341
+ // exports published versions alone. Other packages shown live (a workspace that follows its own) are for looking:
342
+ // an export cooks with their published copies (a cook of its own when the graph names one) and says so
343
+ const locked = argv.includes('--locked'), exportFollow = locked ? [] : followArgs;
344
+ for (const f of pk.following()) {
345
+ console.log(`following ${f.package}: its working folder ${f.dir} instead of its copy, ${exportFollow.includes(f.package) ? 'for renders, inspect and exports (unpublished: the export\'s source record says so)' : 'for renders and inspect (exports use the published copy)'}`);
346
+ }
347
+ const exportNote = pk.publishedNote(graph, exportFollow);
348
+ const exportScope = exportNote ? pk.published(exportFollow) : null;
349
+ /** What to do about followed packages an export would cook from published copies: publish them, or follow them. */
350
+ const publishOrFollow = (pkgs) => pkgs.map((u) => (locked
351
+ ? `publish ${u.package} (${prog} publish ${u.dir} --note "...") and use it: --locked exports published versions alone`
352
+ : `publish ${u.package} (${prog} publish ${u.dir} --note "...") or pass --follow ${u.package} to export from its working folder`)).join('; ');
353
+ /** Why an export cannot cook with the published copies: followed packages it names that have none in use. */
354
+ const exportBlocked = () => {
355
+ const missing = pk.unpublished(graph, exportFollow);
356
+ return missing.length ? `${missing.map((u) => u.package).join(', ')} ${missing.length === 1 ? 'has' : 'have'} no published version in use (this run shows ${missing.length === 1 ? 'its working folder' : 'their working folders'}, for looking): ${publishOrFollow(missing)}` : null;
357
+ };
343
358
  const forExport = async (r, node = r.target) => {
344
359
  if (!exportScope)
345
360
  return r;
361
+ const blocked = exportBlocked();
362
+ if (blocked)
363
+ fail(`export: ${blocked}; nothing was written`);
346
364
  const e = await engine.cook(graph, { target: node, frame: r.frame, fps: r.fps, scope: exportScope });
347
- if (!e.ok || !e.geo)
348
- fail(`export: with the published copies, ${node} does not cook (${e.errors.map((x) => `${x.node}: ${x.message}`).join('; ') || 'no geometry'}); nothing was written`);
365
+ if (!e.ok || !e.geo) {
366
+ const shown = pk.following().filter((f) => !exportFollow.includes(f.package)).map((f) => ({ package: f.package, dir: f.dir }));
367
+ fail(`export: with the published copies, ${node} does not cook (${e.errors.map((x) => `${x.node}: ${x.message}`).join('; ') || 'no geometry'})${shown.length ? `: ${publishOrFollow(shown)}` : ''}; nothing was written`);
368
+ }
349
369
  return e;
350
370
  };
351
371
  const fps = opt('--fps') !== undefined ? Number(opt('--fps')) : undefined;
@@ -393,20 +413,20 @@ async function cook() {
393
413
  }
394
414
  /** Every render flag (renderFlags reads them, plus --views, --color-by, --checker). */
395
415
  const RENDER_FLAGS = ['--wireframe', '--hard-angle', '--section', '--clip', '--glyphs', '--glyph-attrib', '--glyph-scale', '--max-glyphs', '--labels', '--max-labels',
396
- '--shading', '--ao-radius', '--size', '--render-scale', '--azimuth', '--elevation', '--zoom', '--look-at', '--bounds', '--ortho-scale', '--texture', '--max-triangles', '--exposure',
416
+ '--shading', '--ao-radius', '--size', '--render-scale', '--azimuth', '--elevation', '--zoom', '--look-at', '--bounds', '--ortho-scale', '--texture', '--max-triangles', '--exposure', '--cd',
397
417
  '--heightfield-res', '--heightfield-layer', '--underlay', '--underlay-opacity', '--underlay-fit', '--legend', '--points', '--annotate', '--textures', '--transparent',
398
- '--sockets', '--no-view-labels', '--no-footer', '--no-grid', '--views', '--color-by', '--checker'];
418
+ '--sockets', '--grey', '--no-view-labels', '--no-footer', '--no-grid', '--views', '--color-by', '--checker'];
399
419
  /** Render overlay flags → render tool arguments → RenderOptions (src/render/options.ts). */
400
420
  function renderFlags(get, has) {
401
421
  const a = {};
402
422
  for (const [f, k] of [['--wireframe', 'wireframe'], ['--hard-angle', 'hard_angle'], ['--section', 'section'], ['--clip', 'clip'], ['--glyphs', 'glyphs'],
403
423
  ['--glyph-attrib', 'glyph_attrib'], ['--glyph-scale', 'glyph_scale'], ['--max-glyphs', 'max_glyphs'], ['--labels', 'labels'], ['--max-labels', 'max_labels'],
404
424
  ['--shading', 'shading'], ['--ao-radius', 'ao_radius'], ['--size', 'size'], ['--render-scale', 'scale'], ['--azimuth', 'azimuth'], ['--elevation', 'elevation'],
405
- ['--zoom', 'zoom'], ['--look-at', 'look_at'], ['--bounds', 'bounds'], ['--ortho-scale', 'ortho_scale'], ['--texture', 'texture'], ['--max-triangles', 'max_triangles'], ['--exposure', 'exposure'],
425
+ ['--zoom', 'zoom'], ['--look-at', 'look_at'], ['--bounds', 'bounds'], ['--ortho-scale', 'ortho_scale'], ['--texture', 'texture'], ['--max-triangles', 'max_triangles'], ['--exposure', 'exposure'], ['--cd', 'cd'],
406
426
  ['--heightfield-res', 'heightfield_res'], ['--heightfield-layer', 'heightfield_layer'], ['--underlay-opacity', 'underlay_opacity'], ['--underlay-fit', 'underlay_fit']])
407
427
  if (get(f) !== undefined)
408
428
  a[k] = get(f);
409
- for (const [f, k] of [['--legend', 'legend'], ['--points', 'points'], ['--annotate', 'annotate'], ['--textures', 'textures'], ['--transparent', 'transparent'], ['--sockets', 'sockets']])
429
+ for (const [f, k] of [['--legend', 'legend'], ['--points', 'points'], ['--annotate', 'annotate'], ['--textures', 'textures'], ['--transparent', 'transparent'], ['--sockets', 'sockets'], ['--grey', 'grey']])
410
430
  if (has(f))
411
431
  a[k] = true;
412
432
  if (has('--no-view-labels'))
@@ -543,6 +563,9 @@ async function cook() {
543
563
  const refused = published.find((p) => p.target?.refused);
544
564
  if (refused)
545
565
  fail(`--export-all: "${refused.label}": ${prefixGone(refused.target.refused)}; nothing was written`);
566
+ const blocked = exportScope ? exportBlocked() : null;
567
+ if (blocked)
568
+ fail(`--export-all: ${blocked}; nothing was written`);
546
569
  for (const p of published) {
547
570
  if (!p.target)
548
571
  continue;
@@ -16,8 +16,17 @@ export declare function manifoldId(m: any): number;
16
16
  export declare class NotManifoldError extends Error {
17
17
  hint?: string;
18
18
  }
19
- /** Convert closed polygon geometry to a Manifold. Throws a descriptive error when not solid. */
20
- export declare function toManifold(g: Geometry, L?: PropLayout): any;
19
+ /**
20
+ * Convert closed polygon geometry to a Manifold. Throws a descriptive error when not solid. `part` builds it from some of
21
+ * the triangles only (`tri`, a subset of g's triangulation) under a shared original ID, for a solid split into parts.
22
+ */
23
+ export declare function toManifold(g: Geometry, L?: PropLayout, part?: {
24
+ tri: {
25
+ tris: ArrayLike<number>;
26
+ triPrim: ArrayLike<number>;
27
+ };
28
+ id: number;
29
+ }): any;
21
30
  export interface FromManifoldResult {
22
31
  geo: Geometry;
23
32
  primSource: Int32Array;
@@ -46,10 +46,13 @@ export function manifoldId(m) {
46
46
  export class NotManifoldError extends Error {
47
47
  hint;
48
48
  }
49
- /** Convert closed polygon geometry to a Manifold. Throws a descriptive error when not solid. */
50
- export function toManifold(g, L = propLayout([g])) {
49
+ /**
50
+ * Convert closed polygon geometry to a Manifold. Throws a descriptive error when not solid. `part` builds it from some of
51
+ * the triangles only (`tri`, a subset of g's triangulation) under a shared original ID, for a solid split into parts.
52
+ */
53
+ export function toManifold(g, L = propLayout([g]), part) {
51
54
  const W = M();
52
- const { tris, triPrim } = triangulate(g);
55
+ const { tris, triPrim } = part?.tri ?? triangulate(g);
53
56
  if (tris.length === 0)
54
57
  return new W.Manifold(new W.Mesh({ numProp: 3, vertProperties: new Float32Array(0), triVerts: new Uint32Array(0) }));
55
58
  const P = g.P;
@@ -97,7 +100,7 @@ export function toManifold(g, L = propLayout([g])) {
97
100
  for (let i = 0; i < tris.length; i++)
98
101
  triVerts[i] = vertOf[tris[i]];
99
102
  // reserve an explicit original ID so results can be traced back to this input
100
- const id = W.Manifold.reserveIDs(1);
103
+ const id = part?.id ?? W.Manifold.reserveIDs(1);
101
104
  const mesh = new W.Mesh({
102
105
  numProp: L.numProp,
103
106
  vertProperties: Float32Array.from(props),
@@ -5,7 +5,7 @@ export interface Material {
5
5
  roughness: number;
6
6
  emissive: [number, number, number];
7
7
  alpha: number;
8
- /** Absent = legacy auto (blend only for scalar / vertex opacity). */
8
+ /** Absent = auto: blend only when the material's own alpha is below 1 (vertex alpha never changes it). */
9
9
  alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND';
10
10
  alphaCutoff?: number;
11
11
  doubleSided: boolean;
@@ -30,7 +30,8 @@ export declare const MATERIALS_DETAIL = "materials";
30
30
  export declare const DEFAULT_MATERIAL: Readonly<Material>;
31
31
  /** Fill missing fields with defaults and coerce types (tolerant of hand-written tables). */
32
32
  export declare function normalizeMaterial(m: any): Material;
33
- export declare function materialAlphaMode(m: Material, vertexAlpha?: boolean): 'OPAQUE' | 'MASK' | 'BLEND';
33
+ /** The glTF alpha mode of a material: its own alpha_mode, else BLEND when its scalar alpha is below 1. Vertex alpha is data and never promotes it. */
34
+ export declare function materialAlphaMode(m: Material): 'OPAQUE' | 'MASK' | 'BLEND';
34
35
  /** Every texture path used by a table (deduplicated, table order). */
35
36
  export declare function texturePaths(t: MaterialTable): string[];
36
37
  /** The material table stored on the geometry (empty when there is none or it does not parse). */
@@ -35,8 +35,9 @@ function alphaFields(m) {
35
35
  return {};
36
36
  return { alphaMode: mode, ...(mode === 'MASK' ? { alphaCutoff: Math.max(0, Math.min(1, num(m?.alphaCutoff, 0.5))) } : {}) };
37
37
  }
38
- export function materialAlphaMode(m, vertexAlpha = false) {
39
- return m.alphaMode ?? (m.alpha < 1 || vertexAlpha ? 'BLEND' : 'OPAQUE');
38
+ /** The glTF alpha mode of a material: its own alpha_mode, else BLEND when its scalar alpha is below 1. Vertex alpha is data and never promotes it. */
39
+ export function materialAlphaMode(m) {
40
+ return m.alphaMode ?? (m.alpha < 1 ? 'BLEND' : 'OPAQUE');
40
41
  }
41
42
  /** { textures } with the non-empty string slots, or {} when there is none (keeps texture-free tables unchanged). */
42
43
  function textureField(t) {
@@ -17,6 +17,8 @@ export interface TangentDiagnostics {
17
17
  uvNonFinite: number;
18
18
  /** triangles whose uvs are collinear or coincide (zero uv area) */
19
19
  uvDegenerate: number;
20
+ /** collapsed-uv triangles skipped because their world-space area is tiny next to the mean (not counted in uvDegenerate or fallbackCorners) */
21
+ uvThin: number;
20
22
  /** corners that received the fallback tangent */
21
23
  fallbackCorners: number;
22
24
  /** the first triangle with a non-finite or collapsed uv, or -1 (warnings say where it is) */
@@ -77,6 +77,11 @@ function generate(w, P, N, T) {
77
77
  export const mikkTSpaceReady = () => mod?.wasm != null;
78
78
  /** uv triangles whose doubled area is below this fraction of their squared edge lengths are collapsed. */
79
79
  const UV_DEGENERATE = 1e-9;
80
+ /**
81
+ * A triangle whose world area is below this fraction of the mean triangle area is thin (the sides and back of a card
82
+ * a millimetre thick): planar uvs collapse on it by construction, so it is not reported as a collapsed uv.
83
+ */
84
+ const THIN_AREA = 1e-2;
80
85
  /**
81
86
  * MikkTSpace tangents for a triangle soup: pos and nrm 9 floats per triangle, uv 6 (TopoTopo convention). Returns 12
82
87
  * floats per triangle: xyz unit tangent and w = ±1 (bitangent = w · cross(N, T)). Throws when the module is not
@@ -86,9 +91,21 @@ export function mikkTangents(pos, nrm, uv) {
86
91
  if (!mod?.wasm)
87
92
  throw new Error('MikkTSpace is not loaded: await loadMikkTSpace() first (exportGLB, renderPBR and bake_normal do)');
88
93
  const nt = Math.floor(pos.length / 9);
89
- const diag = { triangles: nt, uvNonFinite: 0, uvDegenerate: 0, fallbackCorners: 0, firstBad: -1 };
90
- const bad = new Uint8Array(nt);
94
+ const diag = { triangles: nt, uvNonFinite: 0, uvDegenerate: 0, uvThin: 0, fallbackCorners: 0, firstBad: -1 };
95
+ const bad = new Uint8Array(nt); // 1 = reported, 2 = thin (fallback tangent, not reported)
91
96
  const P = Float32Array.from(pos), N = Float32Array.from(nrm), T = Float32Array.from(uv);
97
+ // world-space area of each triangle, and their mean
98
+ const area = new Float64Array(nt);
99
+ let areaSum = 0;
100
+ for (let t = 0; t < nt; t++) {
101
+ const o = t * 9, ax = P[o + 3] - P[o], ay = P[o + 4] - P[o + 1], az = P[o + 5] - P[o + 2], bx = P[o + 6] - P[o], by = P[o + 7] - P[o + 1], bz = P[o + 8] - P[o + 2];
102
+ const a = 0.5 * Math.hypot(ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx);
103
+ if (Number.isFinite(a)) {
104
+ area[t] = a;
105
+ areaSum += a;
106
+ }
107
+ }
108
+ const thinBelow = nt ? (areaSum / nt) * THIN_AREA : 0;
92
109
  for (let t = 0; t < nt; t++) {
93
110
  let finite = true;
94
111
  for (let k = 0; k < 6; k++)
@@ -106,6 +123,11 @@ export function mikkTangents(pos, nrm, uv) {
106
123
  const u0 = T[t * 6], v0 = T[t * 6 + 1], du1 = T[t * 6 + 2] - u0, dv1 = T[t * 6 + 3] - v0, du2 = T[t * 6 + 4] - u0, dv2 = T[t * 6 + 5] - v0;
107
124
  const e2 = du1 * du1 + dv1 * dv1 + du2 * du2 + dv2 * dv2 + (du2 - du1) ** 2 + (dv2 - dv1) ** 2;
108
125
  if (!(Math.abs(du1 * dv2 - du2 * dv1) > UV_DEGENERATE * e2)) {
126
+ if (area[t] < thinBelow) {
127
+ diag.uvThin++;
128
+ bad[t] = 2;
129
+ continue;
130
+ }
109
131
  diag.uvDegenerate++;
110
132
  bad[t] = 1;
111
133
  if (diag.firstBad < 0)
@@ -143,7 +165,8 @@ export function mikkTangents(pos, nrm, uv) {
143
165
  out[o + 2] = z / l;
144
166
  continue;
145
167
  }
146
- diag.fallbackCorners++;
168
+ if (bad[t] !== 2)
169
+ diag.fallbackCorners++;
147
170
  // the world axis least aligned with N, made perpendicular to it
148
171
  const ax = Math.abs(nx), ay = Math.abs(ny), az = Math.abs(nz);
149
172
  const a = ax <= ay && ax <= az ? [1, 0, 0] : ay <= az ? [0, 1, 0] : [0, 0, 1];
@@ -172,7 +172,7 @@ export declare function warpLayer(a: Float32Array, ch: number, w: number, h: num
172
172
  export declare function sampleBilinear(a: Float32Array, ch: number, w: number, h: number, fx: number, fy: number, out: Float32Array, wrap: boolean): void;
173
173
  /**
174
174
  * Transform a layer: the result at (u, v) samples the source at the inverse of (repeat `tile` times, scale, rotate
175
- * by `rotate` degrees about the centre, offset). wrap = repeat the source; otherwise outside the source is 0.
175
+ * by `rotate` degrees about the centre, offset; the tile cells start at the lower-left corner). wrap = repeat the source; otherwise outside the source is 0.
176
176
  */
177
177
  export declare function transformLayer(a: Float32Array, ch: number, w: number, h: number, offset: [number, number], rotate: number, scale: [number, number], tile: [number, number], wrap: boolean): Float32Array;
178
178
  /** Ramp lookup table: n entries over 0..1 of a ramp evaluator (numbers or [r, g, b]). */
@@ -104,6 +104,12 @@ export function genPattern(o, w, h) {
104
104
  v = (cx + cy) & 1 ? 1 : 0;
105
105
  break;
106
106
  case 'stripes': {
107
+ // vertical stripes by the u count; with a u count of 1 the v count makes horizontal stripes
108
+ if (nx === 1 && ny > 1) {
109
+ cid = cellRand(cy, 0, o.seed);
110
+ v = aa(Math.min(fy, 1 - fy) * chh) * vary(cy, 0);
111
+ break;
112
+ }
107
113
  const sx = u * nx, scx = Math.floor(sx), sf = sx - scx;
108
114
  cid = cellRand(wrapI(scx, nx), 0, o.seed);
109
115
  v = aa(Math.min(sf, 1 - sf) * cw) * vary(wrapI(scx, nx), 0);
@@ -780,12 +786,14 @@ export function sampleBilinear(a, ch, w, h, fx, fy, out, wrap) {
780
786
  }
781
787
  /**
782
788
  * Transform a layer: the result at (u, v) samples the source at the inverse of (repeat `tile` times, scale, rotate
783
- * by `rotate` degrees about the centre, offset). wrap = repeat the source; otherwise outside the source is 0.
789
+ * by `rotate` degrees about the centre, offset; the tile cells start at the lower-left corner). wrap = repeat the source; otherwise outside the source is 0.
784
790
  */
785
791
  export function transformLayer(a, ch, w, h, offset, rotate, scale, tile, wrap) {
786
792
  const out = new Float32Array(a.length);
787
793
  const th = (-rotate * Math.PI) / 180, c = Math.cos(th), s = Math.sin(th);
788
- const sx = (scale[0] || 1e-6) / Math.max(1e-6, tile[0] || 1), sy = (scale[1] || 1e-6) / Math.max(1e-6, tile[1] || 1);
794
+ const sx = scale[0] || 1e-6, sy = scale[1] || 1e-6;
795
+ const tx = Math.max(1e-6, tile[0] || 1), ty = Math.max(1e-6, tile[1] || 1);
796
+ const tiled = tx !== 1 || ty !== 1;
789
797
  const tmp = new Float32Array(ch);
790
798
  const aspect = h / w;
791
799
  for (let j = 0; j < h; j++)
@@ -797,7 +805,8 @@ export function transformLayer(a, ch, w, h, offset, rotate, scale, tile, wrap) {
797
805
  y = (ry / aspect) / sy + 0.5;
798
806
  if (!wrap && (x < 0 || x > 1 || y < 0 || y > 1))
799
807
  continue;
800
- sampleBilinear(a, ch, w, h, x * w, (1 - y) * h, tmp, wrap);
808
+ // tiling is about the lower-left corner of the transformed image: cell 0 starts at uv (0, 0)
809
+ sampleBilinear(a, ch, w, h, x * tx * w, (1 - y * ty) * h, tmp, wrap || tiled);
801
810
  out.set(tmp, (j * w + i) * ch);
802
811
  }
803
812
  return out;
@@ -81,11 +81,15 @@ export declare function orientOutward(g: Geometry): Geometry;
81
81
  * Turn inside-out pieces outward: a connected piece with negative signed volume flips, unless it lies inside another
82
82
  * piece's bounds (the inner wall of a hollow solid faces inward on purpose). A mirror without a winding flip, or a
83
83
  * hand-built cutter, gives such pieces; booleans would make inverted walls from them. Returns the first prim of each
84
- * flipped piece.
84
+ * flipped piece, and the solids the pieces make: each outward piece with the inward pieces (cavity walls) it holds,
85
+ * as a solid index per prim (-1 for empty prims), and whether the bounds of two solids overlap.
85
86
  */
86
87
  export declare function outwardPieces(g: Geometry): {
87
88
  geo: Geometry;
88
89
  flipped: number[];
90
+ solid: Int32Array;
91
+ solids: number;
92
+ overlap: boolean;
89
93
  };
90
94
  /** Quick topology health report used by inspect and by solid ops. */
91
95
  export declare function topologyReport(g: Geometry): {
@@ -691,12 +691,13 @@ export function orientOutward(g) {
691
691
  * Turn inside-out pieces outward: a connected piece with negative signed volume flips, unless it lies inside another
692
692
  * piece's bounds (the inner wall of a hollow solid faces inward on purpose). A mirror without a winding flip, or a
693
693
  * hand-built cutter, gives such pieces; booleans would make inverted walls from them. Returns the first prim of each
694
- * flipped piece.
694
+ * flipped piece, and the solids the pieces make: each outward piece with the inward pieces (cavity walls) it holds,
695
+ * as a solid index per prim (-1 for empty prims), and whether the bounds of two solids overlap.
695
696
  */
696
697
  export function outwardPieces(g) {
697
698
  const { primClass, count } = connectivity(g);
698
699
  if (!count)
699
- return { geo: g, flipped: [] };
700
+ return { geo: g, flipped: [], solid: new Int32Array(g.numPrims).fill(-1), solids: 0, overlap: false };
700
701
  const { tris, triPrim } = triangulate(g);
701
702
  const vol = new Float64Array(count), first = new Int32Array(count).fill(-1);
702
703
  const lo = new Float64Array(count * 3).fill(Infinity), hi = new Float64Array(count * 3).fill(-Infinity);
@@ -736,9 +737,39 @@ export function outwardPieces(g) {
736
737
  flip[c] = 1;
737
738
  flipped.push(first[c]);
738
739
  }
740
+ // a cavity wall joins the smallest outward piece around it
741
+ const size = (c) => (flip[c] ? -vol[c] : vol[c]);
742
+ const owner = new Int32Array(count), index = new Int32Array(count).fill(-1);
743
+ let solids = 0;
744
+ for (let c = 0; c < count; c++) {
745
+ owner[c] = c;
746
+ if (!(size(c) < 0))
747
+ continue;
748
+ let best = -1;
749
+ for (let o = 0; o < count; o++)
750
+ if (size(o) > -size(c) && inside(c, o) && (best < 0 || size(o) < size(best)))
751
+ best = o;
752
+ if (best >= 0)
753
+ owner[c] = best;
754
+ }
755
+ const roots = [];
756
+ for (let c = 0; c < count; c++)
757
+ if (owner[c] === c) {
758
+ index[c] = solids++;
759
+ roots.push(c);
760
+ }
761
+ const solid = Int32Array.from(primClass, (c) => (c >= 0 ? index[owner[c]] : -1));
762
+ // bounds that overlap or touch (touching pieces fuse in a union), swept along x
763
+ roots.sort((a, b) => lo[a * 3] - lo[b * 3]);
764
+ let overlap = false;
765
+ for (let i = 0; i < roots.length && !overlap; i++)
766
+ for (let j = i + 1; j < roots.length && lo[roots[j] * 3] <= hi[roots[i] * 3] && !overlap; j++) {
767
+ const a = roots[i], b = roots[j];
768
+ overlap = lo[a * 3 + 1] <= hi[b * 3 + 1] && lo[b * 3 + 1] <= hi[a * 3 + 1] && lo[a * 3 + 2] <= hi[b * 3 + 2] && lo[b * 3 + 2] <= hi[a * 3 + 2];
769
+ }
739
770
  if (!flipped.length)
740
- return { geo: g, flipped };
741
- return { geo: reversePrims(g, Uint8Array.from(primClass, (c) => (c >= 0 ? flip[c] : 0))), flipped };
771
+ return { geo: g, flipped, solid, solids, overlap };
772
+ return { geo: reversePrims(g, Uint8Array.from(primClass, (c) => (c >= 0 ? flip[c] : 0))), flipped, solid, solids, overlap };
742
773
  }
743
774
  /** Quick topology health report used by inspect and by solid ops. */
744
775
  export function topologyReport(g) {
package/dist/io/gltf.js CHANGED
@@ -55,7 +55,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
55
55
  // embedded (PNG / JPEG) as baseColorTexture, normalTexture and metallicRoughnessTexture (roughness = green channel);
56
56
  // a map replaces its factor (baseColorFactor white, roughnessFactor 1). Without readFile the maps are skipped.
57
57
  // "image:<name>" paths are image volumes of the geometry (texture nodes), encoded to PNG in memory; an "orm" map is
58
- // both the metallicRoughness and the occlusion texture (metallicFactor 1).
58
+ // both the metallicRoughness and the occlusion texture; the material's metallic / roughness are then the factors that multiply it
59
+ // (texture_to_material sets them to 1, or to the values it was given).
59
60
  // options.source (how the export was made, io/source.ts) → asset.extras.source.
60
61
  //
61
62
  // Import
@@ -334,14 +335,14 @@ function getMaterial(st, name, vertexColors, blend, tint) {
334
335
  const roughTex = ormTex ?? tex('roughness');
335
336
  if (ormTex && mat.textures?.roughness)
336
337
  st.warn?.(`glTF: material "${name}" has an orm and a roughness map; the orm map's green channel is used`);
337
- // a map replaces its factor: white base colour under a base colour map, roughness 1 under a roughness map,
338
- // metallic 1 under an ORM map
338
+ // a map replaces its factor: white base colour under a base colour map, roughness 1 under a roughness map; an ORM
339
+ // map's factors are the material's own metallic / roughness (1 unless set)
339
340
  // a folded constant vertex colour multiplies a base colour map exactly as COLOR_0 would have
340
341
  const rgb = tint ?? (vertexColors || baseTex ? [1, 1, 1] : mat.baseColor);
341
342
  m = st.doc.createMaterial(isDefault ? 'default' : name)
342
343
  .setBaseColorFactor([toLinear(rgb[0]), toLinear(rgb[1]), toLinear(rgb[2]), mat.alpha]) // glTF factors are linear
343
- .setMetallicFactor(ormTex ? 1 : mat.metallic)
344
- .setRoughnessFactor(roughTex ? 1 : mat.roughness)
344
+ .setMetallicFactor(mat.metallic)
345
+ .setRoughnessFactor(roughTex && !ormTex ? 1 : mat.roughness)
345
346
  .setDoubleSided(mat.doubleSided);
346
347
  if (baseTex)
347
348
  m.setBaseColorTexture(baseTex);
@@ -359,7 +360,7 @@ function getMaterial(st, name, vertexColors, blend, tint) {
359
360
  }
360
361
  else
361
362
  m.setEmissiveFactor([toLinear(mat.emissive[0]), toLinear(mat.emissive[1]), toLinear(mat.emissive[2])]);
362
- m.setAlphaMode(materialAlphaMode(mat, blend));
363
+ m.setAlphaMode(materialAlphaMode(mat));
363
364
  if (mat.alphaMode === 'MASK')
364
365
  m.setAlphaCutoff(mat.alphaCutoff ?? 0.5);
365
366
  if (mat.unlit)
@@ -574,7 +575,7 @@ export function gltfDocument(g, o = {}) {
574
575
  if (diag.uvNonFinite || diag.uvDegenerate) {
575
576
  // where the first one is: its prim's part and position (core/report.ts)
576
577
  const first = diag.firstBad >= 0 ? `, first ${primWhere(geo, geo.vertexPrims()[tris[diag.firstBad * 3]])}` : '';
577
- o.warn?.(`glTF: ${where}: ${diag.uvDegenerate} of ${diag.triangles} triangles have collapsed uvs${diag.uvNonFinite ? ` and ${diag.uvNonFinite} non-finite uvs` : ''}${first}; their ${diag.fallbackCorners} corners get a fallback tangent (the normal map has no orientation there): unwrap them (uv_unwrap) or give them uv area`);
578
+ o.warn?.(`glTF: ${where}: ${diag.uvDegenerate} of ${diag.triangles} triangles have collapsed uvs${diag.uvNonFinite ? ` and ${diag.uvNonFinite} non-finite uvs` : ''}${first}; their ${diag.fallbackCorners} corners get a fallback tangent (the normal map has no orientation there): unwrap them (uv_unwrap) or give them uv area${diag.uvThin ? `; ${diag.uvThin} thin triangles skipped` : ''}`);
578
579
  }
579
580
  else if (diag.fallbackCorners)
580
581
  o.warn?.(`glTF: ${where}: MikkTSpace left ${diag.fallbackCorners} corners without a tangent; a fallback was written`);
@@ -10,6 +10,8 @@ export interface ExportSource {
10
10
  seeds: Record<string, unknown>;
11
11
  /** the package versions the graph uses (absent when it uses none) */
12
12
  packages?: Record<string, string>;
13
+ /** the packages exported from their working folders, no published version (absent when none) */
14
+ followed?: string[];
13
15
  export: {
14
16
  format: string;
15
17
  options: Record<string, unknown>;
package/dist/io/source.js CHANGED
@@ -10,7 +10,12 @@
10
10
  // seeds the seed params the graph sets, by node ("loop/pts" inside a nested graph), as written
11
11
  // packages only when the graph uses packages (src/graph/packages.ts packagesUsed): "owner/name@version" → the
12
12
  // version's hash for every package version it uses, directly or through other packages (an export
13
- // made while following a working folder cooks with the published copies, so it names those)
13
+ // made while following a working folder cooks with the published copies, so it names those), and
14
+ // "owner/name@working" → the hash of a working folder an export was told to follow (CLI --follow,
15
+ // MCP export follow)
16
+ // followed only when it used working folders ("owner/name@working" under packages): those packages, sorted.
17
+ // They are no published version: the export is made again only from those folders as they were
18
+ // (their hash says whether they still are), replay passes --follow for each
14
19
  // export {format, options}: the export options given (the export tool's names)
15
20
  // package only on a package's outputs cooked for an engine (topotopo cook --for godot, src/host/cook.ts): the
16
21
  // package's publish name, else its id; the cook replaces a file at an output path only when it names
@@ -63,6 +68,8 @@ export function graphSeeds(spec) {
63
68
  walk(spec, '', 0);
64
69
  return sorted(out);
65
70
  }
71
+ /** The packages a packagesUsed record names by working folder ("owner/name@working"), sorted. */
72
+ const followedIn = (packages) => Object.keys(packages ?? {}).filter((k) => k.endsWith('@working')).map((k) => k.slice(0, -'@working'.length)).sort();
66
73
  /** The source block of an export. */
67
74
  export function exportSource(i) {
68
75
  const spec = i.spec;
@@ -76,6 +83,7 @@ export function exportSource(i) {
76
83
  vars: sorted(spec.vars ?? {}),
77
84
  seeds: graphSeeds(spec),
78
85
  ...(i.packages && Object.keys(i.packages).length ? { packages: sorted(i.packages) } : {}),
86
+ ...(followedIn(i.packages).length ? { followed: followedIn(i.packages) } : {}),
79
87
  export: { format: i.format, options: sorted(i.options ?? {}) },
80
88
  ...(i.package ? { package: i.package } : {}),
81
89
  topotopo: i.version,
@@ -94,6 +102,7 @@ export function replayArgs(s, exportPath, flags) {
94
102
  return [
95
103
  ...(s.output ? ['--output', s.output] : ['--node', s.node]),
96
104
  '--frame', String(s.frame), '--fps', String(s.fps),
105
+ ...(s.followed ?? []).flatMap((p) => ['--follow', p]),
97
106
  ...Object.entries(s.vars).flatMap(([k, v]) => ['--var', `${k}=${JSON.stringify(v)}`]),
98
107
  '--format', s.export.format, ...flags(s.export.options), '--export', exportPath,
99
108
  ];
package/dist/mcp/docs.js CHANGED
@@ -136,8 +136,8 @@ says what the open package's workspace holds: its packages as the scan finds the
136
136
  all. A package that publishes versions keeps its own uses and copies (they are published with it). workspace init
137
137
  moves the copies of the packages inside that kept their own.
138
138
  - FOLLOWING: "follow": true shows the workspace's own packages live from their working folders, for looking (the
139
- viewer, renders, inspect); exports and publishing always use the published versions, and an export made while
140
- following says which it used.
139
+ viewer, renders, inspect); exports and publishing use the published versions (but an export told to follow one,
140
+ help topic "packages", FOLLOWING), and an export made while following says which it used.
141
141
  - THE ENGINE: "engine" names the engine project ({"type", "project"}, the path written from the workspace and leading
142
142
  upward when the workspace is inside it) or "none" (kept). workspace init finds it: the nearest at or above the
143
143
  folder, else one below. It says when Unreal will not see the workspace (outside the project's Content/ or a plugin's),
@@ -736,7 +736,7 @@ CUTOUTS: tex_crop extracts a top-left pixel rectangle (all layers), optionally r
736
736
  tex_dilate pads nearest valid pixels; alpha stays unchanged by default. For grey/data maps supply an explicit
737
737
  validity mask (same size). Pack padding reserves empty gutters; dilate supplies the edge values.
738
738
  material {alpha_mode:"mask",alpha_cutoff:0.5,double_sided:true} BEFORE texture_to_material enables cutouts.
739
- Omitted/auto alpha mode retains legacy behaviour; explicit opaque/mask/blend overrides scalar/vertex auto mode.
739
+ Omitted/auto alpha mode blends only for scalar alpha < 1; vertex Alpha (COLOR_0.A) is data and never changes it.
740
740
  Complete example: examples/image_cutouts.json; workflow and layout contract: docs/image-cutouts.md.
741
741
  SEE IT: render of a geometry holding only images shows the "texture" view; render {texture:"<image>"|"image/layer"|
742
742
  "<material>"} adds the view (a material shows its maps as a labelled strip); render {textures:true} samples base
@@ -925,6 +925,10 @@ Nodes:
925
925
  profile placed by sections [{offset, scale, rotate}, ...]; sections with the same point count join point to point
926
926
  (insets keep their corners), closed sections are turned to the first one's winding; closed results face outward.
927
927
  revolve {axis, origin, angle} lathe about any axis line; draw the profile in a plane that holds the axis.
928
+ angle [a0, a1] turns right-handed about the axis (plan angle of the result = -a); caps only for closed profiles and
929
+ then always outward; an open profile gives an open surface, flip reverses it. extrude plane: xz along +Y, xy along +Z,
930
+ yz along +X. sweep end caps are perpendicular to the path (a tilted last segment tilts the cap). grid_split splits
931
+ quads only: cut first (boolean leaves n-gons), then split.
928
932
  shape2d capsule | slot a stadium (rect with half-circle ends) in size; extrude for a slot cutter.
929
933
  project_curve (curves, surface | heightfield) {mode direction|closest, direction, spacing, lift, misses} drapes a
930
934
  curve onto terrain; spacing resamples first so it follows the bumps; writes point hit and N (smooth normals).
@@ -1119,6 +1123,13 @@ on:false or the end of the session; nothing about it is saved. Every edit there
1119
1123
  (the viewer, renders, inspect): exports and publishing use the published copy, and an export made while following
1120
1124
  says which published version it used. A workspace with "follow": true (topotopo workspace init --follow) follows its
1121
1125
  own packages this way, those whose working folder is inside it. Other packages' versions keep the copies they hold.
1126
+ EXPORTING FROM A WORKING FOLDER: an export told to follow a package uses its working folder too: the CLI's --follow
1127
+ studio/trees on a graph-file cook (its --export and --export-all), MCP export {follow:["studio/trees"]} for a package
1128
+ this session follows. It is for a package with no published version yet (an unpublished sibling in the workspace) or
1129
+ for edits not published yet. Such an export is no published version: its source record lists the package under "followed" (and
1130
+ the folder's hash under packages, "studio/trees@working"), and the export says so. An export not told to follow a
1131
+ followed package with no published version in use is refused, saying to publish it or to pass --follow / follow.
1132
+ --locked (a build machine) exports published versions alone: a followed package it does not use fails the run.
1122
1133
 
1123
1134
  OUT OF DATE AND UPDATE: what a package uses changes only by an update, after a before/after.
1124
1135
  - workspace {action:"outdated"} (CLI: topotopo outdated) lists the packages in use that have newer versions:
@@ -1209,6 +1220,8 @@ Which node:
1209
1220
  tiling textures, boxes. box: each polygon along the axis its normal is closest to (X faces u = z, v = y;
1210
1221
  Y faces u = x, v = z; Z faces u = x, v = y); both sides of an axis share it, so faces looking along +X,
1211
1222
  +Y and -Z are MIRRORED (text reads backwards; inspect uv counts them) and -X, -Y, +Z read right.
1223
+ cylindrical scale[0] = tile count around the axis; its top and bottom annuli collapse, so give them a prim
1224
+ group and project them again with method box / planar and group.
1212
1225
  uv_unwrap automatic (xatlas): cuts charts by angle/cost, flattens and packs into 0..1. Default for props and
1213
1226
  hard-surface. Keeps polygons; writes prim chart. Each connected piece is charted on its own; polygons
1214
1227
  xatlas cuts across charts become triangles (exact uv); faces with no area collapse onto a neighbour's
@@ -1307,12 +1320,22 @@ QUESTION → OPTION
1307
1320
  What shape is it? shading:"matcap" (clay, reads form) · "ao" (ambient occlusion: creases and
1308
1321
  cavities darken; ao_radius px) · "flat" (facets, ignores N)
1309
1322
  How do the materials read? Roughness, metal, maps? shading:"pbr": the metallic-roughness material glTF export writes
1310
- (base colour map × vertex colour, tangent-space normal map in the exported MikkTSpace frame, orm or
1323
+ (base colour factor or map, tangent-space normal map in the exported MikkTSpace frame, orm or
1311
1324
  roughness map, metallic, emissive, unlit) under a fixed camera-relative studio rig (key, fill, rim and a
1312
1325
  sky/ground environment), GGX specular, ACES, exposure (stops, default 0). Deterministic: the same graph
1313
- gives the same PNG. Texture files are read from disk; transparency is not evaluated (shaded opaque,
1314
- with a note), nor are missing or non-PNG maps (named in the notes). color_by and highlight tint
1326
+ gives the same PNG. Texture files are read from disk; missing or non-PNG maps are not evaluated
1327
+ (named in the notes). Transparency follows the exported alpha mode: alpha_mode "mask" cuts out
1328
+ pixels below alpha_cutoff (alpha × base colour map alpha), "blend" (or alpha below 1 under "auto")
1329
+ is composited over what is behind, prim by prim from back to front; the inspection shadings
1330
+ (default, flat, matcap, ao) keep drawing blend materials as surfaces. color_by and highlight tint
1315
1331
  the shaded material (the attribute colour lit by the material's brightness); checker is not shown.
1332
+ Vertex colour, as in glTF export: a named material wins (its base colour factor or map; the prims'
1333
+ Cd is not shown, a note says so), Cd colours prims without a material. cd:"multiply" also tints a
1334
+ named material with Cd (vertex paint), cd:"ignore" never shows Cd; cd:"auto" is the default.
1335
+ Are the values right (light and dark, without colour)? grey:true: shading "pbr" with every base colour a neutral
1336
+ 18% grey lit by the studio rig at its luminance (base colour maps and Cd give no colour); roughness,
1337
+ metallic, normal and orm maps, alpha
1338
+ and emissive still apply.
1316
1339
  POLYGON EDGES: wireframe "auto" (the default) draws polygon edges on meshes under 6,000 polygons, never under shading
1317
1340
  "pbr" or textures:true (they would read as marks in the material); the footer says EDGES AUTO when it draws them.
1318
1341
  wireframe:false hides them, true draws them always.
@@ -1361,6 +1384,10 @@ SOURCE: every export (export tool, export targets and the viewer's Export and Do
1361
1384
  --export-all) records how it was made, so it can be made again: a "source" block {graph, graph_sha256 (SHA-256 of the graph JSON as
1362
1385
  cooked: vars after overrides, keys sorted, no whitespace), output (a named output, else null), node, frame, fps, vars
1363
1386
  (all of them, after overrides), seeds (the seed params the graph sets, by node: "loop/pts" inside a body, as written),
1387
+ packages (only when the graph uses packages: "owner/name@version" → the version's hash, every version it uses, and
1388
+ "owner/name@working" → the hash of a working folder the export followed), followed (only when it followed one: those
1389
+ packages, no published version; the export is made again only from those folders as they were, and replay passes
1390
+ --follow for each; help topic "packages", EXPORTING FROM A WORKING FOLDER),
1364
1391
  export: {format, options: every option the format reads, the given ones and the defaults of the rest}, topotopo (the
1365
1392
  version)}. png16 / r16 carry it in their .json sidecar, csv / points.json
1366
1393
  instance rows in <name>.meshes.json, unreal_landscape in landscape.json; every other export writes <file>.source.json
@@ -1368,7 +1395,7 @@ SOURCE: every export (export tool, export targets and the viewer's Export and Do
1368
1395
  it), and glb / gltf also carry it in asset.extras.source. Nothing in it depends on the time or the machine: the same
1369
1396
  graph, values and options give the same bytes, and a later version changing a default does not change what the
1370
1397
  record replays. Replay on the command line: topotopo <graph>.json --output <output> (or --node <node>) --frame <frame>
1371
- --fps <fps>, one --var <name>=<value as JSON> per var, --format <format>, every option as its flag (up_axis "z" →
1398
+ --fps <fps>, one --follow <package> per followed package, one --var <name>=<value as JSON> per var, --format <format>, every option as its flag (up_axis "z" →
1372
1399
  --up-axis z, custom_attribs false → --no-custom-attribs, layers ["a","b"] → --layers a,b) and --export <path>. e.g.
1373
1400
  topotopo graphs/crate.json --node h --frame 1 --fps 24 --format glb --compress none --custom-attribs
1374
1401
  --instancing packed --materials --no-quantize --scale 100 --split-by-name --tangents auto --up-axis z --export crate.glb
@@ -1394,7 +1421,7 @@ MATERIALS: the material node writes prim "material" + the detail table. A named
1394
1421
  material as it is and their Cd / Alpha are dropped (Cd left from colouring parts does not become COLOR_0 or a second,
1395
1422
  white or tinted copy of the material). Prims without a material, and every prim with vertex_colors:true, keep their
1396
1423
  Cd: not all white → baseColor white × COLOR_0 with the material's metallic/roughness/emissive (one constant Cd is
1397
- folded into the factor). alpha < 1 → alphaMode BLEND; unlit → KHR_materials_unlit; emissive above 1 → KHR_materials_emissive_strength.
1424
+ folded into the factor). a material's own alpha < 1 (or alpha_mode blend) → alphaMode BLEND; vertex Alpha is data: it stays COLOR_0.A and never changes the mode; unlit → KHR_materials_unlit; emissive above 1 → KHR_materials_emissive_strength.
1398
1425
  TEXTURES: material {base_color_map, normal_map, roughness_map} (PNG/JPEG paths relative to the package folder; the mesh
1399
1426
  needs uv). glb/gltf embed the images (baseColorTexture, normalTexture, metallicRoughnessTexture = roughness in green; a
1400
1427
  map replaces its factor). usda: UsdUVTexture shaders reading primvars:st, asset paths relative to the .usda. geo/json