@oeave/bakery3 0.0.0-stage → 0.1.0

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.
Files changed (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +562 -2
  3. package/dist/animation-B1h0Ryvj.d.ts +97 -0
  4. package/dist/bake/index.d.ts +369 -0
  5. package/dist/bake/index.js +9 -0
  6. package/dist/bake/index.js.map +1 -0
  7. package/dist/bake-DaOlenyx.d.ts +1357 -0
  8. package/dist/catalog/index.d.ts +100 -0
  9. package/dist/catalog/index.js +154 -0
  10. package/dist/catalog/index.js.map +1 -0
  11. package/dist/catalog.gen-BM-aNf7n.d.ts +733 -0
  12. package/dist/chunk-25ZXSVQ3.js +1107 -0
  13. package/dist/chunk-25ZXSVQ3.js.map +1 -0
  14. package/dist/chunk-3G5QL4F4.js +145 -0
  15. package/dist/chunk-3G5QL4F4.js.map +1 -0
  16. package/dist/chunk-4E5VV4QY.js +12 -0
  17. package/dist/chunk-4E5VV4QY.js.map +1 -0
  18. package/dist/chunk-54WJDN5R.js +3286 -0
  19. package/dist/chunk-54WJDN5R.js.map +1 -0
  20. package/dist/chunk-6NYR73Y7.js +832 -0
  21. package/dist/chunk-6NYR73Y7.js.map +1 -0
  22. package/dist/chunk-6YVQANMW.js +1463 -0
  23. package/dist/chunk-6YVQANMW.js.map +1 -0
  24. package/dist/chunk-AF5BIELI.js +70 -0
  25. package/dist/chunk-AF5BIELI.js.map +1 -0
  26. package/dist/chunk-APBOWWSV.js +92 -0
  27. package/dist/chunk-APBOWWSV.js.map +1 -0
  28. package/dist/chunk-ARMTTZXZ.js +1157 -0
  29. package/dist/chunk-ARMTTZXZ.js.map +1 -0
  30. package/dist/chunk-CX4WTVGH.js +4492 -0
  31. package/dist/chunk-CX4WTVGH.js.map +1 -0
  32. package/dist/chunk-HQTUFVMM.js +1412 -0
  33. package/dist/chunk-HQTUFVMM.js.map +1 -0
  34. package/dist/chunk-MD2U6S4N.js +1952 -0
  35. package/dist/chunk-MD2U6S4N.js.map +1 -0
  36. package/dist/chunk-S4AJTLLN.js +23 -0
  37. package/dist/chunk-S4AJTLLN.js.map +1 -0
  38. package/dist/chunk-TGFNQBKC.js +551 -0
  39. package/dist/chunk-TGFNQBKC.js.map +1 -0
  40. package/dist/chunk-V3QINEEG.js +87 -0
  41. package/dist/chunk-V3QINEEG.js.map +1 -0
  42. package/dist/chunk-W6WQ5UP7.js +91 -0
  43. package/dist/chunk-W6WQ5UP7.js.map +1 -0
  44. package/dist/chunk-WBIAFIHV.js +346 -0
  45. package/dist/chunk-WBIAFIHV.js.map +1 -0
  46. package/dist/chunk-ZEBVAIJJ.js +156 -0
  47. package/dist/chunk-ZEBVAIJJ.js.map +1 -0
  48. package/dist/devtools/index.d.ts +536 -0
  49. package/dist/devtools/index.js +15 -0
  50. package/dist/devtools/index.js.map +1 -0
  51. package/dist/environments/index.d.ts +93 -0
  52. package/dist/environments/index.js +382 -0
  53. package/dist/environments/index.js.map +1 -0
  54. package/dist/hotspots/index.d.ts +111 -0
  55. package/dist/hotspots/index.js +285 -0
  56. package/dist/hotspots/index.js.map +1 -0
  57. package/dist/index.d.ts +944 -0
  58. package/dist/index.js +15 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/node/index.cjs +5115 -0
  61. package/dist/node/index.cjs.map +1 -0
  62. package/dist/node/index.d.cts +4862 -0
  63. package/dist/node/index.d.ts +576 -0
  64. package/dist/node/index.js +1279 -0
  65. package/dist/node/index.js.map +1 -0
  66. package/dist/prepare-C5qVvaw4.d.ts +112 -0
  67. package/dist/presets/index.d.ts +526 -0
  68. package/dist/presets/index.js +14 -0
  69. package/dist/presets/index.js.map +1 -0
  70. package/dist/r3f/index.d.ts +159 -0
  71. package/dist/r3f/index.js +592 -0
  72. package/dist/r3f/index.js.map +1 -0
  73. package/dist/room-S5TLCK4F.js +9 -0
  74. package/dist/room-S5TLCK4F.js.map +1 -0
  75. package/dist/rooms.gen-vhj6sFW5.d.ts +1434 -0
  76. package/dist/session-YCQS4MRH.js +9 -0
  77. package/dist/session-YCQS4MRH.js.map +1 -0
  78. package/dist/shapes/index.d.ts +222 -0
  79. package/dist/shapes/index.js +836 -0
  80. package/dist/shapes/index.js.map +1 -0
  81. package/dist/testRun-BIPXaVPb.d.ts +1130 -0
  82. package/dist/timeline-ChwgD7bT.d.ts +470 -0
  83. package/dist/tsl/index.d.ts +165 -0
  84. package/dist/tsl/index.js +310 -0
  85. package/dist/tsl/index.js.map +1 -0
  86. package/package.json +170 -4
@@ -0,0 +1,1357 @@
1
+ import { A as AnimationSpec } from './animation-B1h0Ryvj.js';
2
+
3
+ /**
4
+ * Room presets: a staged interior the renderer rebuilds by itself.
5
+ *
6
+ * A room preset is a whole set: walls with windows, a floor, a pedestal,
7
+ * the furniture along the walls, the foliage outside the glass that dapples
8
+ * the sunlight, a designed lighting rig per mode. The browser shows a
9
+ * compressed stand-in of it (one small GLB from the preset library) so the
10
+ * developer can frame their product inside it; none of that geometry is
11
+ * captured. The manifest carries only this record (which room, which build
12
+ * of it, which lighting, which surfaces, which stand, where it sits), and
13
+ * the worker rebuilds the room from its own full-resolution copy of the
14
+ * definition. A room render uploads exactly what a bare product render
15
+ * uploads: the product.
16
+ *
17
+ * Two versions guard the pixels. `build` is the content hash of the
18
+ * published room definition the SDK previewed; a worker whose copy hashes
19
+ * differently refuses rather than rendering a room that is not the one on
20
+ * screen. `ROOM_PRESET_VERSION` covers the worker's room builder.
21
+ */
22
+
23
+ declare const ROOM_LIGHTING_MODES: readonly ["day", "golden", "overcast", "night"];
24
+ type RoomLightingMode = (typeof ROOM_LIGHTING_MODES)[number];
25
+ /** A preset material plus an optional sRGB hex tint multiplied into albedo. */
26
+ type RoomSurfaceChoice = {
27
+ material: string;
28
+ /** `#rrggbb`. Plaster and paint take a tint well; a plank floor less so. */
29
+ color?: string;
30
+ };
31
+ /**
32
+ * What the manifest says about the room. Every field except `name`, `build`,
33
+ * `lighting` and `matrix` is an override on the published defaults; absent
34
+ * means "the room's own".
35
+ */
36
+ type RoomPresetSpec = {
37
+ /** The published room, e.g. `loft_golden`. */
38
+ name: string;
39
+ /** Content hash (12 hex) of the published definition. See above. */
40
+ build: string;
41
+ lighting: RoomLightingMode;
42
+ surfaces?: {
43
+ floor?: RoomSurfaceChoice;
44
+ walls?: RoomSurfaceChoice;
45
+ ceiling?: RoomSurfaceChoice;
46
+ /** Window sills: stone or timber. No tint; sills are never painted. */
47
+ sill?: {
48
+ material: string;
49
+ };
50
+ };
51
+ /**
52
+ * What the product stands on. `null` puts nothing under it (the developer
53
+ * placed their own stand, or the product sits on the floor); absent keeps
54
+ * the room's stand. `material` applies to a baked pedestal only; a table
55
+ * used as a stand keeps the finish it came with.
56
+ */
57
+ pedestal?: {
58
+ type: string;
59
+ material?: string;
60
+ } | null;
61
+ /**
62
+ * How much of the room the browser shipped, so the worker does not build
63
+ * it twice. Normally none of the room's geometry crosses the wire.
64
+ *
65
+ * `true`: the whole stand-in is in the GLB, the shell, the stand and the
66
+ * furniture. A bake can then lightmap the room's own surfaces, because a
67
+ * lightmap has to land on a mesh the page holds. The worker builds only
68
+ * what the stand-in cannot carry: the sky, the sun, the portals, the
69
+ * foliage outside the glass, the fixtures' light and the panes.
70
+ *
71
+ * `'stand'`: only the stand is in the GLB, and the worker builds the room
72
+ * around it at full quality. This is what a bake into a prebaked room
73
+ * asks for: that bake lightmaps nothing of the room but the stand, so the
74
+ * light bouncing around the product should come off the real room, not
75
+ * off the browser's compressed preview of it.
76
+ */
77
+ standIn?: boolean | 'stand';
78
+ /**
79
+ * The HDRI outside the windows: an `HDRI_PRESETS` name to put another map
80
+ * there than the room's published one for this mode, turned so its sun
81
+ * sits where the room's sun is; `null` for nothing outside (the mode's
82
+ * plain sky); absent keeps the room's own. In day and golden the room's
83
+ * sun lamp still casts the direct light; the map is the sky's light and
84
+ * the view, projected onto the ground.
85
+ */
86
+ hdri?: string | null;
87
+ /**
88
+ * Pictures of the developer's own in the room's frames, one entry per
89
+ * picture the room hangs, in the order it hangs them. A `sha256:` asset
90
+ * hash puts that image in that frame; `null` or a short list leaves the
91
+ * rest as published.
92
+ *
93
+ * The frame does not move. A picture's moulding, its passepartout and the
94
+ * opening they leave were built to the published image's shape, and the
95
+ * browser shows that geometry while the developer frames the shot, so a
96
+ * replacement is cropped to fill the opening (the way `object-fit: cover`
97
+ * fills a box) rather than resizing the frame around it.
98
+ */
99
+ pictures?: (string | null)[];
100
+ /** The room group's world matrix, three.js column-major. */
101
+ matrix: Matrix4;
102
+ };
103
+
104
+ /**
105
+ * One node. `inputs` are ids of earlier nodes: the array arrives
106
+ * topologically sorted, so the worker builds it in one pass. Constants are
107
+ * nodes too, so every input is a reference and nothing is written twice.
108
+ */
109
+ type ShaderGraphNode = {
110
+ id: string;
111
+ op: string;
112
+ inputs?: string[];
113
+ params?: Record<string, number | string | boolean | number[]>;
114
+ };
115
+ /**
116
+ * Which BSDF slot a graph output drives. Everything not listed here falls
117
+ * back to the material's static properties.
118
+ */
119
+ type ShaderSlot = 'color' | 'opacity' | 'alphaTest' | 'roughness' | 'metalness' | 'normal' | 'emissive' | 'ao' | 'clearcoat' | 'clearcoatRoughness' | 'sheen' | 'sheenRoughness' | 'iridescence' | 'iridescenceIOR' | 'iridescenceThickness' | 'transmission' | 'thickness' | 'ior' | 'specularIntensity' | 'specularColor' | 'anisotropy';
120
+ type ShaderGraph = {
121
+ version: number;
122
+ /** Topologically sorted: a node's inputs always precede it. */
123
+ nodes: ShaderGraphNode[];
124
+ /** Which node feeds which BSDF slot. */
125
+ outputs: Partial<Record<ShaderSlot, string>>;
126
+ };
127
+ /**
128
+ * The static, non-graph half of the material: plain PBR values for every
129
+ * slot no node drives. Captured in full because the glTF exporter does not
130
+ * understand node materials, so the worker rebuilds this material from
131
+ * scratch rather than patching whatever the exporter guessed.
132
+ */
133
+ type ShaderMaterialProperties = {
134
+ color?: string;
135
+ roughness?: number;
136
+ metalness?: number;
137
+ emissive?: string;
138
+ emissiveIntensity?: number;
139
+ opacity?: number;
140
+ transparent?: boolean;
141
+ alphaTest?: number;
142
+ ior?: number;
143
+ transmission?: number;
144
+ thickness?: number;
145
+ attenuationColor?: string;
146
+ attenuationDistance?: number;
147
+ clearcoat?: number;
148
+ clearcoatRoughness?: number;
149
+ sheen?: number;
150
+ sheenColor?: string;
151
+ sheenRoughness?: number;
152
+ specularIntensity?: number;
153
+ specularColor?: string;
154
+ iridescence?: number;
155
+ iridescenceIOR?: number;
156
+ anisotropy?: number;
157
+ doubleSided?: boolean;
158
+ };
159
+ /**
160
+ * One node material, ready to rebuild. Matched to the mesh by the material's
161
+ * uuid, which the SDK stamps through the exporter the same way object ids
162
+ * are.
163
+ */
164
+ type MaterialShaderSpec = {
165
+ materialId: string;
166
+ name?: string;
167
+ /** Which BSDF family the material declared. */
168
+ base: 'standard' | 'physical' | 'basic';
169
+ properties?: ShaderMaterialProperties;
170
+ graph: ShaderGraph;
171
+ };
172
+
173
+ /**
174
+ * The scene manifest: a GLB plus a versioned sidecar.
175
+ *
176
+ * glTF carries geometry, materials, textures, cameras, lights, skins and
177
+ * morph targets well. What it does not carry is the state the running
178
+ * application was in at the moment somebody pressed Render: which objects
179
+ * were hidden, which of four cameras was live, what the renderer's tone
180
+ * mapping was set to, which materials the SDK could not translate and what
181
+ * the developer wants done about them. So the GLB is an asset and this is
182
+ * the contract. `protocolVersion` is versioned independently of the SDK, of
183
+ * the renderer and of the material translator, which is what makes a render
184
+ * from six months ago reproducible.
185
+ *
186
+ * Everything here is JSON (no class instances, no functions) because it
187
+ * travels from the browser through the control plane to the render worker
188
+ * and is stored verbatim for replay.
189
+ */
190
+
191
+ /** `sha256:<64 hex>`: how every immutable blob is named. See asset.ts. */
192
+ type AssetHash = string;
193
+ type Vec3 = [number, number, number];
194
+ /** glTF order: x, y, z, w. Any conversion to another order happens in the worker. */
195
+ type Quat = [number, number, number, number];
196
+ type Matrix4 = number[];
197
+ /**
198
+ * The active camera.
199
+ *
200
+ * Written out in full rather than referenced into the GLB by name: a live
201
+ * R3F camera is frequently not in the scene graph the exporter walked (it
202
+ * is held by `useThree`, or by drei's controls), so it travels as data.
203
+ */
204
+ type CameraSpec = {
205
+ type: 'perspective';
206
+ /** Vertical FOV in degrees, matching three's `PerspectiveCamera.fov`. */
207
+ fov: number;
208
+ /**
209
+ * The viewport's aspect ratio at capture time.
210
+ *
211
+ * The render matches vertical fov, so a wider output shows more at the
212
+ * sides rather than cropping the top and bottom. Recorded so the
213
+ * control plane can default the output to the viewport's own shape.
214
+ */
215
+ aspect?: number;
216
+ near: number;
217
+ far: number;
218
+ position: Vec3;
219
+ quaternion: Quat;
220
+ /** three's `.zoom`, which scales the projection and is easy to forget. */
221
+ zoom?: number;
222
+ /** Present when the developer named a camera; only ever a label. */
223
+ name?: string;
224
+ /** Physical-camera extras. Depth of field is off unless `fStop` is set. */
225
+ focus?: {
226
+ fStop: number;
227
+ focalDistance: number;
228
+ };
229
+ } | {
230
+ type: 'orthographic';
231
+ left: number;
232
+ right: number;
233
+ top: number;
234
+ bottom: number;
235
+ near: number;
236
+ far: number;
237
+ position: Vec3;
238
+ quaternion: Quat;
239
+ zoom?: number;
240
+ name?: string;
241
+ };
242
+ /**
243
+ * What the application had done to the scene by render time.
244
+ *
245
+ * Visibility is an explicit hidden list rather than "export only what is
246
+ * visible" on purpose: the GLB is content-addressed and cached, and a
247
+ * configurator that toggles one part between renders would otherwise miss
248
+ * the cache every time. Ship one GLB with every variant in it, then hide
249
+ * per render: the first render uploads the model, the next one uploads a
250
+ * few KB.
251
+ */
252
+ type RuntimeState = {
253
+ /** Object ids (see `objectId` in capture) the SDK found with `visible === false`. */
254
+ hiddenObjectIds?: string[];
255
+ /**
256
+ * Transform overrides, for objects the application moved after export or
257
+ * that were exported from a shared cached GLB.
258
+ */
259
+ transforms?: Array<{
260
+ objectId: string;
261
+ position?: Vec3;
262
+ quaternion?: Quat;
263
+ scale?: Vec3;
264
+ }>;
265
+ /** Morph target influences, by object. */
266
+ morphs?: Array<{
267
+ objectId: string;
268
+ influences: number[];
269
+ }>;
270
+ /** Current skeletal pose as bone-local matrices. */
271
+ poses?: Array<{
272
+ objectId: string;
273
+ boneMatrices: Matrix4[];
274
+ }>;
275
+ /**
276
+ * `InstancedMesh` transforms. Written here rather than baked into the GLB
277
+ * so changing a layout does not re-upload the geometry.
278
+ *
279
+ * `matrices` is flat: `count * 16` numbers, column-major, exactly as three
280
+ * stores `instanceMatrix.array`. Nested arrays would add two bytes of JSON
281
+ * per instance, which for a large scatter is a measurable part of the
282
+ * manifest.
283
+ */
284
+ instances?: Array<{
285
+ objectId: string;
286
+ count: number;
287
+ matrices: number[];
288
+ }>;
289
+ /**
290
+ * Opaque application state, echoed back on the render record. Never read
291
+ * by the renderer; it exists so a stored render can say which sofa.
292
+ */
293
+ productState?: Record<string, unknown>;
294
+ };
295
+ type EnvironmentSpec = {
296
+ /** An HDRI/EXR the SDK found on `scene.environment`, content-addressed. */
297
+ hdri?: AssetHash;
298
+ /** three's `Scene.environmentIntensity`. */
299
+ intensity?: number;
300
+ /** three's `Scene.environmentRotation`, radians, XYZ euler. */
301
+ rotation?: Vec3;
302
+ /**
303
+ * The scene's `AmbientLight`s as one flat term. It ADDS to the HDRI, as it
304
+ * does in three, and like three's it lights diffuse surfaces only: a
305
+ * mirror reflects the environment and nothing of this.
306
+ */
307
+ ambient?: {
308
+ color: string;
309
+ intensity: number;
310
+ };
311
+ /**
312
+ * Background. `transparent` is the default: a still that composites is
313
+ * worth more to a catalog pipeline than one with a baked backdrop.
314
+ */
315
+ background?: {
316
+ type: 'transparent';
317
+ } | {
318
+ type: 'color';
319
+ color: string;
320
+ } | {
321
+ type: 'environment';
322
+ blurriness?: number;
323
+ };
324
+ /** The scene's fog, when it has one the renderer can trace. */
325
+ fog?: FogSpec;
326
+ };
327
+ /**
328
+ * three's `FogExp2`, which the renderer traces as a volume filling the scene:
329
+ * air that scatters the light passing through it, so a lamp or an emissive
330
+ * mesh sits in a glow and throws visible beams.
331
+ *
332
+ * `density` is three's own number. three fades a surface by
333
+ * `exp(-(density · d)²)`; a real volume thins light by `exp(-σ · d)`. The
334
+ * two cannot agree at every distance, so the renderer uses σ = `density`,
335
+ * which makes them agree where three's fog has taken all but 1/e of the
336
+ * surface: nearer than that the render is a little foggier than the
337
+ * viewport, further a little clearer.
338
+ *
339
+ * `color` is the fog's TINT (`#rrggbb`, as three holds it): its hue colors
340
+ * the scattered light, its brightness is ignored. How bright traced fog
341
+ * looks is decided by the light in it, which a rasterizer's fog color has to
342
+ * guess. A linear `Fog` has no volume it corresponds to and is not carried;
343
+ * the compatibility report says so.
344
+ */
345
+ type FogSpec = {
346
+ color: string;
347
+ density: number;
348
+ };
349
+ /**
350
+ * Lights the SDK lifted out of the scene graph.
351
+ *
352
+ * Exported here as well as in the GLB because glTF's punctual-lights
353
+ * extension has no notion of three's intensity-unit drift, no area lights
354
+ * and no IES. The sidecar is where the good version lives and the GLB copy
355
+ * is the fallback.
356
+ */
357
+ type LightSpec = {
358
+ objectId: string;
359
+ type: 'directional' | 'point' | 'spot' | 'area' | 'hemisphere';
360
+ color: string;
361
+ /**
362
+ * three's own value, unconverted. The worker owns the unit conversion so
363
+ * the physics is written down in one place.
364
+ */
365
+ intensity: number;
366
+ /**
367
+ * World position. A hemisphere light's is its up axis instead (three
368
+ * normalizes it; absent is `[0, 1, 0]`).
369
+ */
370
+ position?: Vec3;
371
+ /**
372
+ * World point a directional, spot or area light aims at, as three's
373
+ * `light.target` (or `lookAt`) does. Absent aims a directional or spot
374
+ * light at the origin and leaves an area light facing straight down.
375
+ */
376
+ target?: Vec3;
377
+ /**
378
+ * Hemisphere lights only: the color from below (`groundColor`). `color` is
379
+ * the sky. Absent is black, a sky with no ground bounce.
380
+ */
381
+ groundColor?: string;
382
+ distance?: number;
383
+ decay?: number;
384
+ angle?: number;
385
+ penumbra?: number;
386
+ /** Area lights only, in world units. */
387
+ size?: {
388
+ width: number;
389
+ height: number;
390
+ };
391
+ /** Angular diameter in degrees: the shadow-softness dial for a sun. */
392
+ angleDeg?: number;
393
+ /** An IES profile, content-addressed. */
394
+ ies?: AssetHash;
395
+ castShadow?: boolean;
396
+ };
397
+ /**
398
+ * The renderer's own color settings, copied verbatim.
399
+ *
400
+ * This is the difference between a render that looks like the developer's
401
+ * app and one that is subtly, unfixably wrong. three's defaults changed in
402
+ * r152 and again in r155; reading the live renderer beats assuming any of
403
+ * them.
404
+ */
405
+ type ColorSpec = {
406
+ outputColorSpace: 'srgb' | 'srgb-linear' | 'display-p3';
407
+ toneMapping: 'none' | 'linear' | 'reinhard' | 'cineon' | 'aces-filmic' | 'agx' | 'neutral';
408
+ toneMappingExposure: number;
409
+ };
410
+ /**
411
+ * What to do with a material the renderer cannot be given honestly.
412
+ *
413
+ * Arbitrary GLSL does not translate, and the answer is to say so rather
414
+ * than quietly render gray. A fallback is the developer's explicit
415
+ * override, from `<Bakery3Material render={...}>` or from
416
+ * `material.userData.bakery3.fallback`.
417
+ */
418
+ type MaterialFallback = {
419
+ /** The material's uuid in the exported GLB. */
420
+ materialId: string;
421
+ type: 'physical';
422
+ color?: string;
423
+ metalness?: number;
424
+ roughness?: number;
425
+ clearcoat?: number;
426
+ clearcoatRoughness?: number;
427
+ transmission?: number;
428
+ thickness?: number;
429
+ ior?: number;
430
+ emissive?: string;
431
+ emissiveIntensity?: number;
432
+ opacity?: number;
433
+ sheen?: number;
434
+ sheenColor?: string;
435
+ iridescence?: number;
436
+ anisotropy?: number;
437
+ };
438
+ type CompatibilitySeverity = 'info' | 'warning' | 'error';
439
+ /**
440
+ * One thing the SDK could not promise to reproduce: what it is, where it
441
+ * lives in the tree, why, and the fix, without opening a debugger.
442
+ */
443
+ type CompatibilityIssue = {
444
+ code: string;
445
+ severity: CompatibilitySeverity;
446
+ message: string;
447
+ /** `<Car>/<Body>/<Paint>`: the path a developer can actually find. */
448
+ path?: string;
449
+ objectId?: string;
450
+ materialId?: string;
451
+ materialName?: string;
452
+ materialType?: string;
453
+ /** Deep link into the docs. */
454
+ docs?: string;
455
+ };
456
+ type CompatibilityReport = {
457
+ /** 0 to 1. Objects that will render faithfully, weighted by triangle count. */
458
+ score: number;
459
+ issues: CompatibilityIssue[];
460
+ /** Rolled up for the devtools panel and the render record. */
461
+ counts: {
462
+ info: number;
463
+ warning: number;
464
+ error: number;
465
+ };
466
+ };
467
+ /** Presets, not raw renderer settings. Most scenes need only these. */
468
+ type QualityPreset = 'preview' | 'studio' | 'ultra';
469
+ type OutputFormat = 'png' | 'jpeg' | 'webp' | 'exr' | 'mp4' | 'webm' | 'png-sequence';
470
+ /** `frames.json`, at the head of a `png-sequence` tar. */
471
+ type FrameSequenceIndex = {
472
+ fps: number;
473
+ frameCount: number;
474
+ width: number;
475
+ height: number;
476
+ bitDepth: 8 | 16;
477
+ /** In frame order, one per frame: `frameFileName(0)` onwards. */
478
+ files: string[];
479
+ };
480
+ type OutputSpec = {
481
+ width: number;
482
+ height: number;
483
+ format: OutputFormat;
484
+ /** JPEG/WebP only, 1 to 100. */
485
+ quality?: number;
486
+ /**
487
+ * PNG and `png-sequence` only: bits per channel, 16 unless 8 is asked
488
+ * for (`PNG_BIT_DEPTH_DEFAULT`).
489
+ */
490
+ bitDepth?: 8 | 16;
491
+ /** Force an opaque background even when the environment is transparent. */
492
+ opaque?: boolean;
493
+ };
494
+ /**
495
+ * Escape hatch under the presets. Present so an expert is never blocked,
496
+ * absent from the quickstart so a beginner is never asked to become a
497
+ * rendering expert to get one image.
498
+ */
499
+ type AdvancedRenderSettings = {
500
+ samples?: number;
501
+ maxBounces?: number;
502
+ diffuseBounces?: number;
503
+ glossyBounces?: number;
504
+ transmissionBounces?: number;
505
+ /** Adaptive sampling noise floor: the real cost dial once denoising is on. */
506
+ adaptiveThreshold?: number;
507
+ denoise?: boolean;
508
+ denoiser?: 'OPTIX' | 'OPENIMAGEDENOISE';
509
+ /** Pays for itself with many emitters, costs overhead with few. */
510
+ lightTree?: boolean;
511
+ /**
512
+ * Light that reaches a surface through glass: the bright pool under a
513
+ * tumbler, the focus line beneath a lens. Off by default: with no caustic
514
+ * paths a transmissive object casts a solid shadow, which is also what the
515
+ * viewport's shadow maps draw, and tracing them costs samples a product
516
+ * shot rarely needs.
517
+ *
518
+ * `'soft'` lets the path tracer find caustic paths itself, with the glossy
519
+ * filter and the indirect clamp (both of which exist to hide caustics)
520
+ * switched off. Unbiased, and slow to converge: a hard light through
521
+ * curved glass stays grainy at studio samples.
522
+ *
523
+ * `'sharp'` adds a dedicated shadow-caustic solver on top: every scene
524
+ * lamp casts caustics, every transmissive mesh is a caster, and every
525
+ * other mesh (the shadow catcher included) receives them. This is what
526
+ * makes a glass on a table converge at normal sample counts. It handles a
527
+ * single refractive object between a lamp and a surface; light from an
528
+ * HDRI or an emissive mesh still goes the `'soft'` way.
529
+ *
530
+ * The solver takes over lamp light through a caster rather than adding to
531
+ * the traced paths, and it only follows light that goes straight through.
532
+ * A faceted stone, whose light leaves after internal reflections, comes
533
+ * back under `'sharp'` with no caustic at all. Cut gems want `'soft'`.
534
+ *
535
+ * Absent is off. There is no boolean on purpose: `caustics: true` would
536
+ * have to mean one of the two. Changes pixels, so it is in the cache key.
537
+ */
538
+ caustics?: 'soft' | 'sharp';
539
+ /**
540
+ * A ceiling on how bright one indirect sample may be, in scene radiance.
541
+ * Absent is the renderer's own default, which `caustics` switches off: a
542
+ * caustic's focus is a very bright indirect sample, and capping it dims
543
+ * the focus. That is right for a still and wrong for a clip, because the
544
+ * rare uncapped hit lands on different pixels every frame, the denoiser
545
+ * smears each one into a soft patch, and the patches boil. For caustics
546
+ * in motion, start at 30 (the pool under a lens is still its full
547
+ * brightness there) and trace larger than you publish.
548
+ *
549
+ * Set, it wins over what `caustics` would have chosen. Changes pixels, so
550
+ * it is in the cache key, present only when set.
551
+ */
552
+ clampIndirect?: number;
553
+ /**
554
+ * Multiplies the converted energy of every light lifted from the scene
555
+ * graph (directional, point, spot, area and the ambient dome) and leaves
556
+ * the HDRI environment alone. The worker's unit table is physics and stays
557
+ * fixed; this dial is for the residual gap, where a viewport (legacy-lights
558
+ * intensities, usually) reads brighter than the physically converted lamps
559
+ * do. One scalar, so the ratio between the scene's lights is preserved.
560
+ * Default 1. Changes pixels, so it is in the cache key.
561
+ */
562
+ lightScale?: number;
563
+ /**
564
+ * Ground the product with a traced shadow catcher. Defaults on for
565
+ * transparent/solid output and off for a visible environment background.
566
+ */
567
+ shadowCatcher?: boolean;
568
+ /** Catcher size, as a multiple of the model's largest dimension. */
569
+ shadowPad?: number;
570
+ /**
571
+ * The renderer's view transform override. Changes pixels, so it is in the
572
+ * cache key. Pinning one also switches off `toneCurveEmulation`: an
573
+ * explicit name is a statement about what the render should look like.
574
+ */
575
+ viewTransform?: string;
576
+ /**
577
+ * Reproduce three's tone mapping exactly instead of substituting the
578
+ * nearest native view transform. On by default, and it is what makes a
579
+ * traced frame the same color as the viewport it came from.
580
+ *
581
+ * Turn it off to get the substitution: a wider, more forgiving curve for a
582
+ * scene whose viewport was never the reference. Changes pixels, so it is
583
+ * in the cache key.
584
+ */
585
+ toneCurveEmulation?: boolean;
586
+ /** Seconds. The worker stops the render rather than billing an unbounded job. */
587
+ timeoutSeconds?: number;
588
+ };
589
+ /**
590
+ * Everything one render needs, minus the bytes.
591
+ *
592
+ * Typically a few KB. The heavy things (the GLB, textures, the HDRI) are
593
+ * `sha256:` references that the control plane resolves against storage the
594
+ * SDK already filled (see asset.ts).
595
+ */
596
+ type SceneManifest = {
597
+ protocolVersion: string;
598
+ sdkVersion: string;
599
+ /** The exported GLB. */
600
+ sceneAsset: AssetHash;
601
+ /**
602
+ * Extra blobs this scene needs that are not inside the GLB: an HDRI, an
603
+ * IES profile, a texture the SDK stripped out to keep the GLB cacheable.
604
+ */
605
+ assets?: AssetHash[];
606
+ camera: CameraSpec;
607
+ runtime?: RuntimeState;
608
+ environment?: EnvironmentSpec;
609
+ lights?: LightSpec[];
610
+ color: ColorSpec;
611
+ fallbacks?: MaterialFallback[];
612
+ /**
613
+ * Node materials, as portable shader graphs (see shader.ts). The GLB still
614
+ * carries the mesh; the material the exporter wrote for it is a stand-in
615
+ * that the worker replaces wholesale with the rebuilt graph.
616
+ */
617
+ shaders?: MaterialShaderSpec[];
618
+ /**
619
+ * Baked per-frame motion (see animation.ts). Present only for a video,
620
+ * and its presence is what makes this a 3.0 manifest.
621
+ *
622
+ * Not inside `runtime` on purpose: runtime is the one state the
623
+ * application was in when Render was pressed, and every field in it is a
624
+ * single value. A sequence is a different kind of thing.
625
+ */
626
+ animation?: AnimationSpec;
627
+ /**
628
+ * A room preset around the product (see room.ts). Its geometry, lights
629
+ * and sky are not in the GLB or in `lights`: the worker rebuilds all of it
630
+ * from the published definition, so a product in a room uploads only the
631
+ * product. Presence makes this a 4.0 manifest.
632
+ */
633
+ room?: RoomPresetSpec;
634
+ compatibility?: CompatibilityReport;
635
+ /**
636
+ * What the scene weighs, measured by the SDK at capture. The control plane
637
+ * prices with it (a dense scene traces slower per pixel and unwraps slower
638
+ * per object), so the quote a job is accepted under is the same one
639
+ * `estimate()` gave with the same numbers. Operational, not visual: it is
640
+ * outside every cache key.
641
+ */
642
+ stats?: {
643
+ triangles: number;
644
+ /** Bytes of texture the manifest's shader graphs sample, when known. */
645
+ textureBytes?: number;
646
+ /**
647
+ * Distinct materials that emit light: a standard material with a
648
+ * non-black emissive color, an unlit material (rendered as emission), or
649
+ * a node material with an emission graph. The worker turns its light
650
+ * tree on from this. Only the SDK can count them, since the GLB's
651
+ * materials are opaque to the control plane.
652
+ */
653
+ emitters?: number;
654
+ /**
655
+ * How much of the sky above the camera the scene's geometry hides, 0 for
656
+ * an open set and 1 inside a closed room (`SceneComplexity`). Walls keep
657
+ * light bouncing, which is most of what makes an interior slow to render,
658
+ * so the quote reads it. A preset room's stand-in counts, though it is not
659
+ * uploaded: it stands for the room the renderer builds.
660
+ */
661
+ enclosure?: number;
662
+ /** Meshes the scene draws, instances counted: how full it is. */
663
+ objects?: number;
664
+ };
665
+ /**
666
+ * Where the scene came from. Diagnostics only, but "which three version"
667
+ * is the first question every support conversation starts with.
668
+ */
669
+ source?: {
670
+ three?: string;
671
+ r3f?: string;
672
+ renderer?: string;
673
+ userAgent?: string;
674
+ };
675
+ };
676
+ /** A manifest plus what to make from it. This is the render request body. */
677
+ type RenderSpec = {
678
+ manifest: SceneManifest;
679
+ quality: QualityPreset;
680
+ output: OutputSpec;
681
+ advanced?: AdvancedRenderSettings;
682
+ /**
683
+ * Hard ceiling in USD. Exceeded at estimate time means the job is refused
684
+ * before it is admitted: `RenderBudgetExceeded`, not a surprise bill.
685
+ */
686
+ maxCost?: number;
687
+ /** Emit a low-sample preview partway through. On by default for `studio`. */
688
+ preview?: boolean;
689
+ /** Echoed on the render record and every webhook. */
690
+ metadata?: Record<string, unknown>;
691
+ /**
692
+ * A resubmit with the same key returns the existing render while it is
693
+ * running or once it has completed, never a second charge. This is what
694
+ * makes the SDK's own retries safe. A key whose render failed, was
695
+ * cancelled or expired is free again: nothing was charged, and the
696
+ * resubmit renders.
697
+ */
698
+ idempotencyKey?: string;
699
+ /**
700
+ * `high` puts this render ahead of the account's other waiting work in
701
+ * the same lane: the hero shot before the rest of the queue. It never
702
+ * jumps a lane; a person waiting still goes first.
703
+ */
704
+ priority?: 'normal' | 'high';
705
+ };
706
+
707
+ /**
708
+ * The texel ceiling for one bake, enforced at estimate time before any GPU
709
+ * time is bought. Texels drive a bake's cost the way frames drive a video's;
710
+ * 32M texels is a full room at sensible resolutions.
711
+ */
712
+ declare const MAX_BAKE_TEXELS: number;
713
+ /**
714
+ * The object-count ceiling for one bake job. A request past it is refused,
715
+ * never sampled down.
716
+ */
717
+ declare const MAX_BAKE_OBJECTS = 256;
718
+ /**
719
+ * How good a bake should be. The worker chooses sample counts and margins
720
+ * from this, the way `QualityPreset` maps to `QualitySettings`.
721
+ */
722
+ type BakeQuality = 'preview' | 'standard' | 'high';
723
+ /** The sides a lightmap or a stand-in texture may have, in texels. */
724
+ declare const BAKE_TEXTURE_SIZES: readonly [256, 512, 1024, 2048];
725
+ type BakeTextureSize = (typeof BAKE_TEXTURE_SIZES)[number];
726
+ /** Atlas sides. 4096² is 16.8M texels, inside the texel ceiling on its own. */
727
+ declare const BAKE_ATLAS_SIZES: readonly [1024, 2048, 4096];
728
+ type BakeAtlasSize = (typeof BAKE_ATLAS_SIZES)[number];
729
+ /**
730
+ * One lightmap for every baked object, rather than one each.
731
+ *
732
+ * A room of sixty objects lit from sixty textures is sixty texture binds and
733
+ * sixty downloads; lit from one atlas it is one of each, which is what an
734
+ * interactive scene wants. The atlas holds the same texels the separate maps
735
+ * would, and is priced as they are.
736
+ *
737
+ * Every object is baked into a square of its own: the side its world-space
738
+ * surface earns, capped by `textureSize` and `sizes` as usual, times the
739
+ * square root of its `weight`, rounded to a power of two. The squares are
740
+ * laid into the map with no waste, and the map is filled: when the squares
741
+ * would cover under a quarter of it every side doubles, and when they would
742
+ * not fit the largest are halved until they do. So `textureSize`, `sizes`
743
+ * and `weights` set relative shares, kept to within a power of two, and
744
+ * `size` sets the texels there are to share.
745
+ *
746
+ * A hero product is `weights: { [heroId]: 4 }`: twice the side and four times
747
+ * the area its surface alone would earn. Weights round to the nearest power
748
+ * of two in side: 1.5 to 2.8 doubles it, 2.9 to 5.6 quadruples it.
749
+ */
750
+ type BakeAtlas = {
751
+ size: BakeAtlasSize;
752
+ /** Per-object density multipliers, keyed by objectId. Default 1. */
753
+ weights?: Record<string, number>;
754
+ };
755
+ /**
756
+ * What a group of objects is replaced with in the baked scene.
757
+ *
758
+ * A lightmap keeps the developer's geometry and changes its light. That is
759
+ * right for a product and wrong for a bookcase of forty books at the back of
760
+ * the room: forty draw calls, forty lightmaps and forty unwraps to light
761
+ * something the viewer reads as one lit shape. A stand-in is that one shape,
762
+ * with the detail it lost baked on: the color of the surface it replaces, a
763
+ * normal map for the relief it no longer has, and the irradiance traced at
764
+ * the real surface. The real objects stay in the traced scene, so they still
765
+ * cast their shadows and bounce their light onto everything else; they are
766
+ * only absent from what is delivered.
767
+ *
768
+ * `'lowpoly'` the objects, shrink-wrapped into one skin and reduced to
769
+ * `triangles`. The default.
770
+ * `'box'` the box round them, turned about the vertical to fit.
771
+ * Right for anything that reads as a box from where it is
772
+ * seen: a bookcase, a cabinet, a radiator.
773
+ * `'billboard'` one upright picture of them that turns to face the
774
+ * camera. For a potted plant: half a million triangles of
775
+ * leaves that no lightmap suits and no box resembles.
776
+ * `{ objectId }` a mesh of the developer's own, in the captured scene and
777
+ * hidden (so nothing traces it), used as the stand-in's
778
+ * shape exactly as authored.
779
+ * `'decimate'` one object, the same object with fewer triangles: its own
780
+ * parts, silhouette, texture uvs and materials kept, reduced
781
+ * to `triangles` by collapsing edges. For the product itself
782
+ * (a 146k-triangle shoe), where a skin would melt laces and
783
+ * eyelets together and a baked color would turn metal and
784
+ * gloss into paint. Only its light is baked, in one pass at
785
+ * the real surface; the stand-in wears the replaced object's
786
+ * own materials at their own resolution. One entry per
787
+ * object.
788
+ */
789
+ type BakeSimplifyTo = 'lowpoly' | 'box' | 'billboard' | 'decimate' | {
790
+ objectId: string;
791
+ };
792
+ type BakeSimplify = {
793
+ /**
794
+ * objectIds the stand-in replaces. They are not in `include`: a replaced
795
+ * object gets no lightmap of its own, which is where the saving is.
796
+ */
797
+ objects: string[];
798
+ to: BakeSimplifyTo;
799
+ /** `'lowpoly'` only: the triangle budget. Default `BAKE_SIMPLIFY_TRIANGLES`. */
800
+ triangles?: number;
801
+ /** The stand-in's texture side. Default `textureSize`. */
802
+ textureSize?: BakeTextureSize;
803
+ };
804
+ /**
805
+ * A plane under the baked objects carrying the difference they make to the
806
+ * light on it, and nothing else.
807
+ *
808
+ * A preset room is the same room for every customer, so its lightmaps are a
809
+ * library asset, baked once and served from the preset library
810
+ * (`BakeBundle.room`). What that prebaked room cannot know is the product
811
+ * standing in it: the contact shadow under a vase is what makes it look like
812
+ * it is in the room rather than pasted over it.
813
+ *
814
+ * So the bake traces one small plane just above the floor twice, with the
815
+ * product and its stand present and again with them hidden, and ships the
816
+ * ratio: 1 where they changed nothing, darker where they blocked light. The
817
+ * viewer lays it over the floor and multiplies. A ratio, not irradiance,
818
+ * because it has to compose with a floor lightmap traced at another time and
819
+ * another resolution.
820
+ *
821
+ * It only darkens. Light the product throws onto the floor (a red vase's
822
+ * bounce) is in neither the prebaked room nor this plane; that is the
823
+ * approximation this mode makes.
824
+ */
825
+ type BakeShadow = {
826
+ /**
827
+ * Scene units, Y-up: the plane's centre, on the surface it lies over.
828
+ *
829
+ * Absent is the usual case: the worker measures the footprint of whatever
830
+ * casts, then finds the surface beneath with rays cast straight down and
831
+ * the casters hidden. A plinth is often modelled a centimetre into the
832
+ * floor, so the bottom of its bounds is inside the slab, where a plane
833
+ * would be lit in neither trace.
834
+ */
835
+ center?: [number, number, number];
836
+ /**
837
+ * Metres. Absent takes the casters' footprint plus the room a shadow needs
838
+ * to spread into.
839
+ */
840
+ width?: number;
841
+ height?: number;
842
+ /**
843
+ * How far above the surface the plane sits, in metres. Small enough to
844
+ * read as contact, large enough that nothing z-fights with the floor.
845
+ */
846
+ lift?: number;
847
+ /** Texels a side. Default `BAKE_SHADOW_SIZE`. */
848
+ textureSize?: BakeTextureSize;
849
+ /**
850
+ * objectIds whose shadow this is: hidden for the second trace. Absent
851
+ * means every object the bake includes.
852
+ */
853
+ cast?: string[];
854
+ /**
855
+ * objectIds the plane is placed beneath and sized to cover. Absent means
856
+ * the casters, which is the usual case.
857
+ *
858
+ * The two lists come apart when a product stands on something this bake is
859
+ * lightmapping anyway. A vase on a plinth casts on the plinth's top, and
860
+ * the plinth's own lightmap carries that. What the plinth must not do is
861
+ * cast into this plane: the prebaked room was lit with the plinth standing
862
+ * in it, so its shadow is already on that floor, and casting it again
863
+ * would lay it down twice.
864
+ *
865
+ * So the plinth spans but does not cast. It is present in both traces and
866
+ * divides out of the ratio exactly, leaving only what the vase adds; and
867
+ * because it is hidden while the surface beneath is looked for, the plane
868
+ * still lands on the floor rather than on the plinth's top.
869
+ */
870
+ spans?: string[];
871
+ };
872
+ /**
873
+ * What the bake produced for `BakeSettings.shadow`.
874
+ *
875
+ * `uri` is a ratio in 0..1 per channel, linear, one value per texel: what
876
+ * fraction of the light still arrives with the product there. Lay the plane
877
+ * at `center` + `lift` on its up axis, map this across it, and multiply.
878
+ */
879
+ type BakedShadow = {
880
+ uri: string;
881
+ format: 'exr' | 'png';
882
+ size: number;
883
+ center: [number, number, number];
884
+ width: number;
885
+ height: number;
886
+ lift: number;
887
+ /**
888
+ * The darkest ratio in the map, for a panel and for a sanity check: a
889
+ * shadow that came out 1.0 everywhere means nothing was cast.
890
+ */
891
+ darkest: number;
892
+ };
893
+ /**
894
+ * What to bake and how well.
895
+ *
896
+ * `include` is explicit and authoritative: the SDK decides which objects can
897
+ * take a lightmap (it can see the live materials; the worker cannot) and the
898
+ * worker bakes exactly that list. An id the worker cannot find is a refusal
899
+ * with the id and a fix, never a silent skip.
900
+ */
901
+ type BakeSettings = {
902
+ quality: BakeQuality;
903
+ /**
904
+ * Per-object resolution ceiling. The worker may choose a smaller size for
905
+ * a small object (by world-space surface area) so a screw does not cost
906
+ * what a wall costs. It never chooses larger.
907
+ */
908
+ textureSize: BakeTextureSize;
909
+ /** objectIds to bake, from the same id space as `RuntimeState`. */
910
+ include: string[];
911
+ /** Per-object override of `textureSize`, keyed by objectId. */
912
+ sizes?: Record<string, BakeTextureSize>;
913
+ /**
914
+ * Bake every object into one shared lightmap of `atlas.size`² texels
915
+ * instead of one texture each: see `BakeAtlas`. `textureSize` and `sizes`
916
+ * then set each object's relative share of the map rather than its own
917
+ * texture.
918
+ */
919
+ atlas?: BakeAtlas;
920
+ /** Seam dilation in pixels. Default 4. */
921
+ margin?: number;
922
+ /**
923
+ * Also produce the portable baked GLB: every baked object with an unlit
924
+ * material (`KHR_materials_unlit`) whose one texture is the finished
925
+ * surface (color, direct and bounced light, reflections as seen from
926
+ * `view`, through the scene's tone curve). Loads anywhere with no lights
927
+ * and no SDK. A second bake pass per object, so it roughly doubles GPU
928
+ * time and is opt-in.
929
+ */
930
+ deliverGlb?: boolean;
931
+ /**
932
+ * Objects whose `uv1` is the developer's own layout, not one a previous
933
+ * bake wrote. Present, the worker may use an object's own layout instead
934
+ * of unwrapping it: its `uv1` when listed here, its texture `uv` when the
935
+ * mesh is too fragmented or too dense to unwrap well. Either is used only
936
+ * when it passes the worker's test (inside the unit square, no stacked
937
+ * islands, enough texels an island, an even density), and the result says
938
+ * so with `BakeUv` `channel`. Absent, every object is unwrapped.
939
+ */
940
+ existingUv?: {
941
+ uv1: string[];
942
+ };
943
+ /**
944
+ * Where the scene is looked at from, for seam placement only.
945
+ *
946
+ * The unwrap puts island boundaries on the side of each object that faces
947
+ * away from this point, on its underside, or where it is hidden behind
948
+ * other geometry, never across the surface this viewpoint sees. Nothing
949
+ * about the lighting depends on it.
950
+ *
951
+ * It is not the manifest camera. The camera is excluded from the bake
952
+ * cache key so that orbiting and baking again is free, and a seam layout
953
+ * that followed the exact camera would make every orbit a re-cut. The SDK
954
+ * sends the camera quantized (`quantizeBakeView`): direction in 30° steps,
955
+ * distance in octaves around the baked objects, so nearby viewpoints share
956
+ * a bake and only a real change of side re-cuts.
957
+ *
958
+ * Absent: seams prefer the underside and hard edges alone.
959
+ */
960
+ view?: BakeView;
961
+ /**
962
+ * Where the reflection probe is taken, and what is hidden from it.
963
+ *
964
+ * Every bake delivers one. The lightmap replaces a baked surface's
965
+ * diffuse, but the objects the bake is for (the product kept live on its
966
+ * plinth, so it can turn and change finish) still reflect the scene's own
967
+ * environment map, which in a baked room is not the room. The probe is the
968
+ * room as seen from where those objects stand, with those objects hidden
969
+ * so they do not reflect themselves, and the SDK puts it on their
970
+ * materials as `envMap`.
971
+ *
972
+ * The SDK decides both fields: the objects it hides are the ones that
973
+ * could have been baked and were deliberately left out. An object that
974
+ * cannot take a lightmap at all (a glass sphere, an instanced hedge) is
975
+ * scenery and stays in the map, so the product reflects the glass beside
976
+ * it. Absent, the worker takes the probe from the center of the baked
977
+ * objects and hides nothing.
978
+ */
979
+ probe?: BakeProbe;
980
+ /**
981
+ * Groups of objects to deliver as a stand-in rather than light as they
982
+ * are: see `BakeSimplify`. In request order; stand-in `n` of the bundle is
983
+ * entry `n` here.
984
+ */
985
+ simplify?: BakeSimplify[];
986
+ /**
987
+ * Trace a shadow plane under the baked objects: see `BakeShadow`. What a
988
+ * bake of a product standing in a prebaked room needs, and the only part
989
+ * of that room the bake has to pay for.
990
+ */
991
+ shadow?: BakeShadow;
992
+ /**
993
+ * How a preset room in the scene is lit.
994
+ *
995
+ * `'full'` (the default) bakes the room's own surfaces along with
996
+ * everything else.
997
+ *
998
+ * `'preset'` says the room is unmodified, so its lightmaps are a library
999
+ * asset and this bake covers only what the library cannot know: the
1000
+ * product, the stand it is on, and the shadow it casts. The SDK only asks
1001
+ * for it when the room really is unmodified, and the worker records which
1002
+ * room the result stands on (`BakeBundle.room`).
1003
+ */
1004
+ room?: 'full' | 'preset';
1005
+ };
1006
+ /** A viewpoint, in the scene's own (Y-up, meters) coordinates. */
1007
+ type BakeView = {
1008
+ position: [number, number, number];
1009
+ };
1010
+ /** The reflection probe's request: where, and what not to see. */
1011
+ type BakeProbe = {
1012
+ /** Scene units, Y-up: the center of the objects the probe is for. */
1013
+ position: [number, number, number];
1014
+ /** objectIds hidden from the probe: the objects it will be applied to. */
1015
+ hide: string[];
1016
+ };
1017
+ /**
1018
+ * A manifest plus what to bake from it: the bake request body. The manifest
1019
+ * is the ordinary capture, camera included but unused by the bake itself, so
1020
+ * two captures that differ only by viewpoint hit the same bake cache entry.
1021
+ */
1022
+ type BakeSpec = {
1023
+ manifest: SceneManifest;
1024
+ bake: BakeSettings;
1025
+ advanced?: {
1026
+ timeoutSeconds?: number;
1027
+ };
1028
+ /**
1029
+ * Triangles in the objects `bake.include` names, for the quote only.
1030
+ *
1031
+ * The estimate has two triangle terms: syncing the whole scene (priced from
1032
+ * the manifest's own count) and unwrapping the objects being baked (priced
1033
+ * from this). Without it the unwrap term is priced against the whole
1034
+ * scene, which over-quotes a partial bake of a big room. The SDK sends it;
1035
+ * a request without it is quoted the higher way.
1036
+ *
1037
+ * Deliberately not inside `bake`: that object is the bake cache key, and a
1038
+ * number that only moves a price must not move what is cached.
1039
+ */
1040
+ bakedTriangles?: number;
1041
+ /**
1042
+ * Hard ceiling in USD, refused at estimate time. The same contract as
1043
+ * `RenderSpec.maxCost`.
1044
+ */
1045
+ maxCost?: number;
1046
+ metadata?: Record<string, unknown>;
1047
+ idempotencyKey?: string;
1048
+ };
1049
+ /**
1050
+ * The second UV set for one object, in the live geometry's own vertex order.
1051
+ *
1052
+ * `values` alone: `2 * vertexCount` floats, writable straight into a `uv1`
1053
+ * BufferAttribute on the existing geometry. The common case, and the one
1054
+ * that leaves the developer's geometry object untouched.
1055
+ *
1056
+ * `topology`: the unwrap needed vertex splits. `vertexSource[i]` names the
1057
+ * original vertex that new vertex `i` was copied from, so every original
1058
+ * attribute (custom ones included) can be gathered through it and nothing
1059
+ * the developer authored is lost in the rebuild. `index` is the new triangle
1060
+ * list over the new vertices.
1061
+ */
1062
+ type BakeUv = {
1063
+ values: number[];
1064
+ } | {
1065
+ topology: {
1066
+ vertexSource: number[];
1067
+ index: number[];
1068
+ values: number[];
1069
+ };
1070
+ }
1071
+ /**
1072
+ * The lightmap is laid on a uv set the mesh already has: `0` is its
1073
+ * texture uv (three's `uv`, glTF `TEXCOORD_0`), `1` its second set (`uv1`,
1074
+ * `TEXCOORD_1`). Nothing is shipped and nothing is rebuilt: the SDK points
1075
+ * the lightmap at that attribute (`texture.channel`). Such a lightmap is
1076
+ * written in the glTF orientation (v = 0 at the top), the one the
1077
+ * attribute is in; every unwrap the worker ships itself is bottom-up.
1078
+ * Only sent to an SDK that asked for it (`BakeSettings.existingUv`).
1079
+ */
1080
+ | {
1081
+ channel: 0 | 1;
1082
+ };
1083
+ /**
1084
+ * One baked object. `uri` is resolved against the bundle's own location: a
1085
+ * relative path on disk, an absolute URL from a server.
1086
+ */
1087
+ type BakedObject = {
1088
+ objectId: string;
1089
+ /** The object's name at capture time, for humans reading a bundle. */
1090
+ name?: string;
1091
+ /** HDR diffuse irradiance (direct + indirect, no albedo), linear. */
1092
+ lightmap: {
1093
+ uri: string;
1094
+ format: 'exr' | 'png';
1095
+ size: number;
1096
+ };
1097
+ /** Small LDR thumbnail for pickers and panels. */
1098
+ preview?: {
1099
+ uri: string;
1100
+ };
1101
+ uv: BakeUv;
1102
+ /**
1103
+ * How the surface was cut, measured by the worker, so a panel can say
1104
+ * "2 islands, seams out of view" and mean it.
1105
+ *
1106
+ * `cut: 'hidden'` is the viewpoint-aware layout; `'angle'` is the plain
1107
+ * angle-limited fallback, used when the hidden-seam layout failed its
1108
+ * checks for this object (the job log says so too). `seamsInView` is the
1109
+ * fraction of seam length across smooth surface whose both sides face
1110
+ * `BakeSettings.view`; 0 is the goal. Seams on creases are not counted,
1111
+ * because they do not show.
1112
+ */
1113
+ layout?: {
1114
+ islands: number;
1115
+ seamsInView?: number;
1116
+ /**
1117
+ * `'uv0'`/`'uv1'`: the object's own uv set, chosen over an unwrap
1118
+ * because it passed the worker's layout test.
1119
+ */
1120
+ cut: 'hidden' | 'angle' | 'uv0' | 'uv1';
1121
+ };
1122
+ /**
1123
+ * In an atlas bake: the fraction of the shared map this object's islands
1124
+ * cover, which is what its budget and weight actually bought it.
1125
+ */
1126
+ atlasShare?: number;
1127
+ };
1128
+ /**
1129
+ * One stand-in, ready to be put in the scene: see `BakeSimplify`.
1130
+ *
1131
+ * A mesh carries its geometry inline, in the scene's own coordinates (world
1132
+ * space, Y-up, meters), because it is a few hundred vertices and a loader
1133
+ * for it would weigh more than it does. `uv` is the one unwrap every map
1134
+ * uses. `tangent` (xyzw) is the frame the normal map was baked in; a viewer
1135
+ * that derives tangents from uv derivatives instead will be close, not
1136
+ * exact. `color` is an sRGB PNG and `normal` a linear one, both the right
1137
+ * way up for an ordinary image loader (`flipY` on); `lightmap` follows the
1138
+ * lightmap contract above.
1139
+ *
1140
+ * A billboard is an upright rectangle `width` by `height` centered on
1141
+ * `center`, to be turned about the vertical to face the camera, and `map` is
1142
+ * linear radiance with alpha: the objects as traced from `BakeSettings.view`'s
1143
+ * side, lit by the whole scene, with everything else cut away. It goes
1144
+ * through the viewer's own tone mapping like everything around it.
1145
+ */
1146
+ type BakedProxy = {
1147
+ kind: 'mesh';
1148
+ /** Index into `settings.simplify`. */
1149
+ index: number;
1150
+ replaces: string[];
1151
+ name?: string;
1152
+ geometry: {
1153
+ position: number[];
1154
+ normal: number[];
1155
+ uv: number[];
1156
+ tangent?: number[];
1157
+ index: number[];
1158
+ };
1159
+ color: {
1160
+ uri: string;
1161
+ };
1162
+ normal: {
1163
+ uri: string;
1164
+ };
1165
+ lightmap: {
1166
+ uri: string;
1167
+ format: 'exr';
1168
+ size: number;
1169
+ };
1170
+ /** The replaced surfaces' roughness and metalness, area weighted. */
1171
+ roughness: number;
1172
+ metalness: number;
1173
+ layout?: BakedObject['layout'];
1174
+ } | {
1175
+ /** `to: 'decimate'`: the replaced object with fewer triangles. */
1176
+ kind: 'decimated';
1177
+ index: number;
1178
+ /** The one object it replaces, whose materials it wears. */
1179
+ replaces: [string];
1180
+ name?: string;
1181
+ /**
1182
+ * In the scene's frame, like a mesh stand-in's. `uv` is the object's
1183
+ * own texture uv, carried through the decimation, in the glTF
1184
+ * orientation its texture maps expect; `uv1` is present when the
1185
+ * lightmap needed an unwrap of its own. `groups` are its material
1186
+ * slots, in the order of the replaced mesh's materials.
1187
+ */
1188
+ geometry: {
1189
+ position: number[];
1190
+ normal: number[];
1191
+ uv: number[];
1192
+ uv1?: number[];
1193
+ /** Its vertex colors (glTF COLOR_0), linear RGB, when it had them. */
1194
+ color?: number[];
1195
+ index: number[];
1196
+ groups?: Array<{
1197
+ start: number;
1198
+ count: number;
1199
+ materialIndex: number;
1200
+ }>;
1201
+ };
1202
+ lightmap: {
1203
+ uri: string;
1204
+ format: 'exr';
1205
+ size: number;
1206
+ };
1207
+ /** The uv set the lightmap reads: 0 is `uv`, 1 is `uv1`. */
1208
+ lightmapChannel: 0 | 1;
1209
+ triangles: {
1210
+ from: number;
1211
+ to: number;
1212
+ };
1213
+ layout?: BakedObject['layout'];
1214
+ } | {
1215
+ kind: 'billboard';
1216
+ index: number;
1217
+ replaces: string[];
1218
+ name?: string;
1219
+ center: [number, number, number];
1220
+ width: number;
1221
+ height: number;
1222
+ map: {
1223
+ uri: string;
1224
+ format: 'exr';
1225
+ width: number;
1226
+ height: number;
1227
+ };
1228
+ };
1229
+ /**
1230
+ * An object the bake did not produce, with the reason and the fix, per
1231
+ * object: "the bake finished" must never quietly mean "except for the glass
1232
+ * and the instanced chairs".
1233
+ */
1234
+ type BakeSkip = {
1235
+ objectId: string;
1236
+ name?: string;
1237
+ code: string;
1238
+ message: string;
1239
+ why?: string;
1240
+ fix?: string;
1241
+ /**
1242
+ * The object was baked; this is a complaint about how well.
1243
+ *
1244
+ * An ordinary entry here means a lightmap was not made and the object is
1245
+ * still lit the way it was. A `warning` means one was made and is worse
1246
+ * than it should be. `BakeCoarseUnwrap` is the case: a surface whose
1247
+ * geometry is far finer than the map it earns cuts into more islands than
1248
+ * the map has room for, and the result is padding with a little light in
1249
+ * it.
1250
+ */
1251
+ warning?: true;
1252
+ };
1253
+ /**
1254
+ * Everything one bake produced. The bundle file is written last, so an
1255
+ * interrupted bake never looks finished.
1256
+ */
1257
+ type BakeBundle = {
1258
+ bundleVersion: 1;
1259
+ /** The `BAKE_VERSION` that produced this. */
1260
+ bakeVersion: number;
1261
+ settings: BakeSettings;
1262
+ objects: BakedObject[];
1263
+ skipped: BakeSkip[];
1264
+ /**
1265
+ * When `settings.atlas` was set: the one lightmap every object's
1266
+ * `lightmap.uri` names, so a loader can fetch it once and share it. Each
1267
+ * object's `uv` is already in the atlas's space.
1268
+ */
1269
+ atlas?: {
1270
+ uri: string;
1271
+ format: 'exr' | 'png';
1272
+ size: number;
1273
+ preview?: {
1274
+ uri: string;
1275
+ };
1276
+ /** Fraction of the map's texels some island maps to: packing efficiency. */
1277
+ coverage?: number;
1278
+ };
1279
+ /**
1280
+ * The stand-ins `settings.simplify` asked for. One that could not be built
1281
+ * is in `skipped` under the id `simplify[n]`, and the objects it would have
1282
+ * replaced are left as they were.
1283
+ */
1284
+ proxies?: BakedProxy[];
1285
+ /** The shadow plane `settings.shadow` asked for. */
1286
+ shadow?: BakedShadow;
1287
+ /**
1288
+ * The prebaked room this bake stands its objects in: an unmodified preset
1289
+ * room whose own lightmaps are a library asset, not something this bake
1290
+ * paid for. The SDK fetches that bundle and applies it underneath this
1291
+ * one. Absent from an ordinary bake, which lights everything it covers.
1292
+ */
1293
+ room?: {
1294
+ /** The preset and the lighting it was baked under. */
1295
+ name: string;
1296
+ lighting: string;
1297
+ /**
1298
+ * The published room's build hash, which is what makes the prebake this
1299
+ * room and not a later edit of it.
1300
+ */
1301
+ build: string;
1302
+ /** Where the prebaked bundle is, on the preset library. */
1303
+ uri: string;
1304
+ };
1305
+ /** The portable unlit GLB, when `deliverGlb` was set. */
1306
+ glb?: {
1307
+ uri: string;
1308
+ };
1309
+ /**
1310
+ * The reflection probe: a linear HDR equirectangular map of the scene from
1311
+ * `position`, in three's own equirect convention (load it, set
1312
+ * `EquirectangularReflectionMapping`, and it is an `envMap`). `hidden` are
1313
+ * the objects it was taken without, which are the ones to put it on.
1314
+ */
1315
+ probe?: {
1316
+ uri: string;
1317
+ format: 'exr';
1318
+ width: number;
1319
+ height: number;
1320
+ position: [number, number, number];
1321
+ hidden: string[];
1322
+ /**
1323
+ * The probe as an LDR picture, for a panel, a drawer or a figure: the
1324
+ * same map through `exposure` (chosen by the worker to put its mean at
1325
+ * middle gray), Reinhard and sRGB. A label on the file, not something to
1326
+ * light with.
1327
+ */
1328
+ preview?: {
1329
+ uri: string;
1330
+ exposure?: number;
1331
+ };
1332
+ };
1333
+ stats?: {
1334
+ texels: number;
1335
+ gpuSeconds?: number;
1336
+ /**
1337
+ * Where those seconds went, by step (`scene`, `probe`, `unwrap`,
1338
+ * `trace`, `repair`, `denoise`, `export`, `standIns`), summed over the
1339
+ * objects.
1340
+ */
1341
+ seconds?: Record<string, number>;
1342
+ };
1343
+ };
1344
+ /**
1345
+ * A bundle without its uv arrays and stand-in geometry: what a job result
1346
+ * carries once the files are in storage. The arrays are the bulk of a bundle
1347
+ * (a dense room's are megabytes) and belong in `bundle.json`, which the SDK
1348
+ * reads from storage.
1349
+ */
1350
+ type BakeBundleSummary = Omit<BakeBundle, 'objects' | 'proxies'> & {
1351
+ objects: Array<Omit<BakedObject, 'uv'>>;
1352
+ /** Stand-ins without their geometry, for the same reason. */
1353
+ proxies?: Array<DistributiveOmit<BakedProxy, 'geometry'>>;
1354
+ };
1355
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
1356
+
1357
+ export { type AssetHash as A, type BakeTextureSize as B, type ColorSpec as C, type EnvironmentSpec as E, type FrameSequenceIndex as F, type MaterialShaderSpec as M, type OutputSpec as O, type QualityPreset as Q, type RenderSpec as R, type SceneManifest as S, type Vec3 as V, type BakeQuality as a, type BakeAtlas as b, type BakeView as c, type CompatibilityReport as d, type BakeSpec as e, type BakeBundleSummary as f, type CameraSpec as g, type CompatibilityIssue as h, type BakeSettings as i, type BakeBundle as j, type ShaderSlot as k, type BakeSkip as l, type BakeUv as m, type BakedObject as n, type OutputFormat as o, type ShaderGraph as p, type ShaderGraphNode as q, BAKE_TEXTURE_SIZES as r, MAX_BAKE_OBJECTS as s, MAX_BAKE_TEXELS as t };