@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.
- package/LICENSE +21 -0
- package/README.md +562 -2
- package/dist/animation-B1h0Ryvj.d.ts +97 -0
- package/dist/bake/index.d.ts +369 -0
- package/dist/bake/index.js +9 -0
- package/dist/bake/index.js.map +1 -0
- package/dist/bake-DaOlenyx.d.ts +1357 -0
- package/dist/catalog/index.d.ts +100 -0
- package/dist/catalog/index.js +154 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog.gen-BM-aNf7n.d.ts +733 -0
- package/dist/chunk-25ZXSVQ3.js +1107 -0
- package/dist/chunk-25ZXSVQ3.js.map +1 -0
- package/dist/chunk-3G5QL4F4.js +145 -0
- package/dist/chunk-3G5QL4F4.js.map +1 -0
- package/dist/chunk-4E5VV4QY.js +12 -0
- package/dist/chunk-4E5VV4QY.js.map +1 -0
- package/dist/chunk-54WJDN5R.js +3286 -0
- package/dist/chunk-54WJDN5R.js.map +1 -0
- package/dist/chunk-6NYR73Y7.js +832 -0
- package/dist/chunk-6NYR73Y7.js.map +1 -0
- package/dist/chunk-6YVQANMW.js +1463 -0
- package/dist/chunk-6YVQANMW.js.map +1 -0
- package/dist/chunk-AF5BIELI.js +70 -0
- package/dist/chunk-AF5BIELI.js.map +1 -0
- package/dist/chunk-APBOWWSV.js +92 -0
- package/dist/chunk-APBOWWSV.js.map +1 -0
- package/dist/chunk-ARMTTZXZ.js +1157 -0
- package/dist/chunk-ARMTTZXZ.js.map +1 -0
- package/dist/chunk-CX4WTVGH.js +4492 -0
- package/dist/chunk-CX4WTVGH.js.map +1 -0
- package/dist/chunk-HQTUFVMM.js +1412 -0
- package/dist/chunk-HQTUFVMM.js.map +1 -0
- package/dist/chunk-MD2U6S4N.js +1952 -0
- package/dist/chunk-MD2U6S4N.js.map +1 -0
- package/dist/chunk-S4AJTLLN.js +23 -0
- package/dist/chunk-S4AJTLLN.js.map +1 -0
- package/dist/chunk-TGFNQBKC.js +551 -0
- package/dist/chunk-TGFNQBKC.js.map +1 -0
- package/dist/chunk-V3QINEEG.js +87 -0
- package/dist/chunk-V3QINEEG.js.map +1 -0
- package/dist/chunk-W6WQ5UP7.js +91 -0
- package/dist/chunk-W6WQ5UP7.js.map +1 -0
- package/dist/chunk-WBIAFIHV.js +346 -0
- package/dist/chunk-WBIAFIHV.js.map +1 -0
- package/dist/chunk-ZEBVAIJJ.js +156 -0
- package/dist/chunk-ZEBVAIJJ.js.map +1 -0
- package/dist/devtools/index.d.ts +536 -0
- package/dist/devtools/index.js +15 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/environments/index.d.ts +93 -0
- package/dist/environments/index.js +382 -0
- package/dist/environments/index.js.map +1 -0
- package/dist/hotspots/index.d.ts +111 -0
- package/dist/hotspots/index.js +285 -0
- package/dist/hotspots/index.js.map +1 -0
- package/dist/index.d.ts +944 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/node/index.cjs +5115 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +4862 -0
- package/dist/node/index.d.ts +576 -0
- package/dist/node/index.js +1279 -0
- package/dist/node/index.js.map +1 -0
- package/dist/prepare-C5qVvaw4.d.ts +112 -0
- package/dist/presets/index.d.ts +526 -0
- package/dist/presets/index.js +14 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/r3f/index.d.ts +159 -0
- package/dist/r3f/index.js +592 -0
- package/dist/r3f/index.js.map +1 -0
- package/dist/room-S5TLCK4F.js +9 -0
- package/dist/room-S5TLCK4F.js.map +1 -0
- package/dist/rooms.gen-vhj6sFW5.d.ts +1434 -0
- package/dist/session-YCQS4MRH.js +9 -0
- package/dist/session-YCQS4MRH.js.map +1 -0
- package/dist/shapes/index.d.ts +222 -0
- package/dist/shapes/index.js +836 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/testRun-BIPXaVPb.d.ts +1130 -0
- package/dist/timeline-ChwgD7bT.d.ts +470 -0
- package/dist/tsl/index.d.ts +165 -0
- package/dist/tsl/index.js +310 -0
- package/dist/tsl/index.js.map +1 -0
- package/package.json +170 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/protocol/manifest.ts","../src/protocol/quality.ts","../src/version.ts"],"names":[],"mappings":";AAwCO,IAAM,gBAAA,GAAmB,KAAA;AAGzB,IAAM,qBAAA,GAAwB,KAAA;AAG9B,IAAM,yBAAA,GAA4B,KAAA;AAQlC,IAAM,sBAAA,GAAyB,KAAA;AAW/B,SAAS,mBAAmB,QAAA,EAIxB;AACT,EAAA,IAAI,QAAA,CAAS,WAAA,EAAa,GAAA,EAAK,OAAO,gBAAA;AACtC,EAAA,IAAI,QAAA,CAAS,MAAM,OAAO,qBAAA;AAC1B,EAAA,OAAO,QAAA,CAAS,YACZ,yBAAA,GACA,sBAAA;AACN;AAkTO,IAAM,aAAA,GAAgC,CAAC,KAAA,EAAO,MAAM,CAAA;AAUpD,IAAM,gBAAA,GAAmC,CAAC,cAAc,CAAA;AAGxD,SAAS,cAAc,MAAA,EAA+B;AAC3D,EAAA,OAAO,aAAA,CAAc,SAAS,MAAM,CAAA;AACtC;AAGO,SAAS,iBAAiB,MAAA,EAA+B;AAC9D,EAAA,OAAO,gBAAA,CAAiB,SAAS,MAAM,CAAA;AACzC;AAQO,SAAS,aAAa,MAAA,EAAqC;AAChE,EAAA,OACE,WAAW,MAAA,KACV,aAAA,CAAc,MAAsB,CAAA,IACnC,iBAAiB,MAAsB,CAAA,CAAA;AAE7C;;;AC3XO,IAAM,OAAA,GAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW7D,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,CAAA;AAAA,IACT,OAAA,EAAS,EAAA;AAAA,IACT,iBAAA,EAAmB,IAAA;AAAA,IACnB,UAAA,EAAY,CAAA;AAAA,IACZ,cAAA,EAAgB,CAAA;AAAA,IAChB,aAAA,EAAe,CAAA;AAAA,IACf,mBAAA,EAAqB,CAAA;AAAA,IACrB,OAAA,EAAS,KAAA;AAAA,IACT,eAAA,EAAiB,IAAA;AAAA,IACjB,OAAA,EAAS,KAAA;AAAA,IACT,cAAA,EAAgB;AAAA,GAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,CAAA;AAAA,IACT,OAAA,EAAS,GAAA;AAAA,IACT,iBAAA,EAAmB,IAAA;AAAA,IACnB,UAAA,EAAY,CAAA;AAAA,IACZ,cAAA,EAAgB,CAAA;AAAA,IAChB,aAAA,EAAe,CAAA;AAAA,IACf,mBAAA,EAAqB,CAAA;AAAA,IACrB,OAAA,EAAS,IAAA;AAAA,IACT,eAAA,EAAiB,IAAA;AAAA,IACjB,OAAA,EAAS,IAAA;AAAA,IACT,cAAA,EAAgB;AAAA,GAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,CAAA;AAAA,IACT,OAAA,EAAS,IAAA;AAAA,IACT,iBAAA,EAAmB,IAAA;AAAA,IACnB,UAAA,EAAY,EAAA;AAAA,IACZ,cAAA,EAAgB,CAAA;AAAA,IAChB,aAAA,EAAe,EAAA;AAAA,IACf,mBAAA,EAAqB,EAAA;AAAA,IACrB,OAAA,EAAS,IAAA;AAAA,IACT,eAAA,EAAiB,IAAA;AAAA,IACjB,OAAA,EAAS,IAAA;AAAA,IACT,cAAA,EAAgB;AAAA;AAEpB;;;AClGO,IAAM,WAAA,GAAc","file":"chunk-APBOWWSV.js","sourcesContent":["/**\n * The scene manifest: a GLB plus a versioned sidecar.\n *\n * glTF carries geometry, materials, textures, cameras, lights, skins and\n * morph targets well. What it does not carry is the state the running\n * application was in at the moment somebody pressed Render: which objects\n * were hidden, which of four cameras was live, what the renderer's tone\n * mapping was set to, which materials the SDK could not translate and what\n * the developer wants done about them. So the GLB is an asset and this is\n * the contract. `protocolVersion` is versioned independently of the SDK, of\n * the renderer and of the material translator, which is what makes a render\n * from six months ago reproducible.\n *\n * Everything here is JSON (no class instances, no functions) because it\n * travels from the browser through the control plane to the render worker\n * and is stored verbatim for replay.\n */\n\nimport type { AnimationSpec } from './animation.js';\nimport type { RoomPresetSpec } from './room.js';\nimport type { MaterialShaderSpec } from './shader.js';\n\n/**\n * Bumped only for a change a worker cannot read straight through. A worker\n * refuses a manifest whose major it does not implement rather than guessing;\n * a plausible wrong image is worse than a refusal.\n *\n * 2.0: `shaders`, node-material graphs. Without them a worker would render\n * the exporter's gray stand-in as if it were the material.\n *\n * 3.0: `animation`, baked per-frame channels. Without them a worker would\n * hand back one still of frame zero for a five-second orbit.\n *\n * 4.0: `room`, a room preset the worker rebuilds itself (see room.ts). The\n * room's geometry is deliberately not in the GLB, so a worker that ignored\n * the field would render the product floating in nothing.\n *\n * 5.0: `environment.fog`, the scene's fog traced as a volume. A worker that\n * ignored the field would hand back the scene in clear air.\n */\nexport const PROTOCOL_VERSION = '5.0';\n\n/** What a manifest with a room preset and no fog is stamped with. */\nexport const PROTOCOL_VERSION_ROOM = '4.0';\n\n/** What an animated manifest without a room preset is stamped with. */\nexport const PROTOCOL_VERSION_ANIMATED = '3.0';\n\n/**\n * What a manifest carrying no animation is stamped with. A still is still a\n * 2.0 document (every field in it means what it meant before), so stamping\n * it higher would only strand it at a worker not yet updated. See\n * `protocolVersionFor`.\n */\nexport const PROTOCOL_VERSION_STILL = '2.0';\n\n/** Every major the current worker can render faithfully. */\nexport const SUPPORTED_PROTOCOL_MAJORS = ['1', '2', '3', '4', '5'];\n\n/**\n * The version to stamp on a manifest: the lowest major that reads every\n * field in it faithfully (5.0 with fog, 4.0 with a room preset, 3.0 if\n * animated, 2.0 otherwise), so a manifest never strands itself at an older\n * worker for a field it does not carry.\n */\nexport function protocolVersionFor(manifest: {\n animation?: AnimationSpec;\n room?: RoomPresetSpec;\n environment?: { fog?: FogSpec };\n}): string {\n if (manifest.environment?.fog) return PROTOCOL_VERSION;\n if (manifest.room) return PROTOCOL_VERSION_ROOM;\n return manifest.animation\n ? PROTOCOL_VERSION_ANIMATED\n : PROTOCOL_VERSION_STILL;\n}\n\n/** `sha256:<64 hex>`: how every immutable blob is named. See asset.ts. */\nexport type AssetHash = string;\n\nexport type Vec3 = [number, number, number];\n/** glTF order: x, y, z, w. Any conversion to another order happens in the worker. */\nexport type Quat = [number, number, number, number];\nexport type Matrix4 = number[];\n\n// ---------------------------------------------------------------------------\n// Camera\n// ---------------------------------------------------------------------------\n\n/**\n * The active camera.\n *\n * Written out in full rather than referenced into the GLB by name: a live\n * R3F camera is frequently not in the scene graph the exporter walked (it\n * is held by `useThree`, or by drei's controls), so it travels as data.\n */\nexport type CameraSpec =\n | {\n type: 'perspective';\n /** Vertical FOV in degrees, matching three's `PerspectiveCamera.fov`. */\n fov: number;\n /**\n * The viewport's aspect ratio at capture time.\n *\n * The render matches vertical fov, so a wider output shows more at the\n * sides rather than cropping the top and bottom. Recorded so the\n * control plane can default the output to the viewport's own shape.\n */\n aspect?: number;\n near: number;\n far: number;\n position: Vec3;\n quaternion: Quat;\n /** three's `.zoom`, which scales the projection and is easy to forget. */\n zoom?: number;\n /** Present when the developer named a camera; only ever a label. */\n name?: string;\n /** Physical-camera extras. Depth of field is off unless `fStop` is set. */\n focus?: { fStop: number; focalDistance: number };\n }\n | {\n type: 'orthographic';\n left: number;\n right: number;\n top: number;\n bottom: number;\n near: number;\n far: number;\n position: Vec3;\n quaternion: Quat;\n zoom?: number;\n name?: string;\n };\n\n// ---------------------------------------------------------------------------\n// Runtime state: the part glTF cannot express\n// ---------------------------------------------------------------------------\n\n/**\n * What the application had done to the scene by render time.\n *\n * Visibility is an explicit hidden list rather than \"export only what is\n * visible\" on purpose: the GLB is content-addressed and cached, and a\n * configurator that toggles one part between renders would otherwise miss\n * the cache every time. Ship one GLB with every variant in it, then hide\n * per render: the first render uploads the model, the next one uploads a\n * few KB.\n */\nexport type RuntimeState = {\n /** Object ids (see `objectId` in capture) the SDK found with `visible === false`. */\n hiddenObjectIds?: string[];\n /**\n * Transform overrides, for objects the application moved after export or\n * that were exported from a shared cached GLB.\n */\n transforms?: Array<{\n objectId: string;\n position?: Vec3;\n quaternion?: Quat;\n scale?: Vec3;\n }>;\n /** Morph target influences, by object. */\n morphs?: Array<{ objectId: string; influences: number[] }>;\n /** Current skeletal pose as bone-local matrices. */\n poses?: Array<{ objectId: string; boneMatrices: Matrix4[] }>;\n /**\n * `InstancedMesh` transforms. Written here rather than baked into the GLB\n * so changing a layout does not re-upload the geometry.\n *\n * `matrices` is flat: `count * 16` numbers, column-major, exactly as three\n * stores `instanceMatrix.array`. Nested arrays would add two bytes of JSON\n * per instance, which for a large scatter is a measurable part of the\n * manifest.\n */\n instances?: Array<{ objectId: string; count: number; matrices: number[] }>;\n /**\n * Opaque application state, echoed back on the render record. Never read\n * by the renderer; it exists so a stored render can say which sofa.\n */\n productState?: Record<string, unknown>;\n};\n\n// ---------------------------------------------------------------------------\n// Environment and lighting\n// ---------------------------------------------------------------------------\n\nexport type EnvironmentSpec = {\n /** An HDRI/EXR the SDK found on `scene.environment`, content-addressed. */\n hdri?: AssetHash;\n /** three's `Scene.environmentIntensity`. */\n intensity?: number;\n /** three's `Scene.environmentRotation`, radians, XYZ euler. */\n rotation?: Vec3;\n /**\n * The scene's `AmbientLight`s as one flat term. It ADDS to the HDRI, as it\n * does in three, and like three's it lights diffuse surfaces only: a\n * mirror reflects the environment and nothing of this.\n */\n ambient?: { color: string; intensity: number };\n /**\n * Background. `transparent` is the default: a still that composites is\n * worth more to a catalog pipeline than one with a baked backdrop.\n */\n background?:\n | { type: 'transparent' }\n | { type: 'color'; color: string }\n | { type: 'environment'; blurriness?: number };\n /** The scene's fog, when it has one the renderer can trace. */\n fog?: FogSpec;\n};\n\n/**\n * three's `FogExp2`, which the renderer traces as a volume filling the scene:\n * air that scatters the light passing through it, so a lamp or an emissive\n * mesh sits in a glow and throws visible beams.\n *\n * `density` is three's own number. three fades a surface by\n * `exp(-(density · d)²)`; a real volume thins light by `exp(-σ · d)`. The\n * two cannot agree at every distance, so the renderer uses σ = `density`,\n * which makes them agree where three's fog has taken all but 1/e of the\n * surface: nearer than that the render is a little foggier than the\n * viewport, further a little clearer.\n *\n * `color` is the fog's TINT (`#rrggbb`, as three holds it): its hue colors\n * the scattered light, its brightness is ignored. How bright traced fog\n * looks is decided by the light in it, which a rasterizer's fog color has to\n * guess. A linear `Fog` has no volume it corresponds to and is not carried;\n * the compatibility report says so.\n */\nexport type FogSpec = {\n color: string;\n density: number;\n};\n\n/**\n * Lights the SDK lifted out of the scene graph.\n *\n * Exported here as well as in the GLB because glTF's punctual-lights\n * extension has no notion of three's intensity-unit drift, no area lights\n * and no IES. The sidecar is where the good version lives and the GLB copy\n * is the fallback.\n */\nexport type LightSpec = {\n objectId: string;\n type: 'directional' | 'point' | 'spot' | 'area' | 'hemisphere';\n color: string;\n /**\n * three's own value, unconverted. The worker owns the unit conversion so\n * the physics is written down in one place.\n */\n intensity: number;\n /**\n * World position. A hemisphere light's is its up axis instead (three\n * normalizes it; absent is `[0, 1, 0]`).\n */\n position?: Vec3;\n /**\n * World point a directional, spot or area light aims at, as three's\n * `light.target` (or `lookAt`) does. Absent aims a directional or spot\n * light at the origin and leaves an area light facing straight down.\n */\n target?: Vec3;\n /**\n * Hemisphere lights only: the color from below (`groundColor`). `color` is\n * the sky. Absent is black, a sky with no ground bounce.\n */\n groundColor?: string;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n /** Area lights only, in world units. */\n size?: { width: number; height: number };\n /** Angular diameter in degrees: the shadow-softness dial for a sun. */\n angleDeg?: number;\n /** An IES profile, content-addressed. */\n ies?: AssetHash;\n castShadow?: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Color management\n// ---------------------------------------------------------------------------\n\n/**\n * The renderer's own color settings, copied verbatim.\n *\n * This is the difference between a render that looks like the developer's\n * app and one that is subtly, unfixably wrong. three's defaults changed in\n * r152 and again in r155; reading the live renderer beats assuming any of\n * them.\n */\nexport type ColorSpec = {\n outputColorSpace: 'srgb' | 'srgb-linear' | 'display-p3';\n toneMapping:\n | 'none'\n | 'linear'\n | 'reinhard'\n | 'cineon'\n | 'aces-filmic'\n | 'agx'\n | 'neutral';\n toneMappingExposure: number;\n};\n\n// ---------------------------------------------------------------------------\n// Material fallbacks and compatibility\n// ---------------------------------------------------------------------------\n\n/**\n * What to do with a material the renderer cannot be given honestly.\n *\n * Arbitrary GLSL does not translate, and the answer is to say so rather\n * than quietly render gray. A fallback is the developer's explicit\n * override, from `<Bakery3Material render={...}>` or from\n * `material.userData.bakery3.fallback`.\n */\nexport type MaterialFallback = {\n /** The material's uuid in the exported GLB. */\n materialId: string;\n type: 'physical';\n color?: string;\n metalness?: number;\n roughness?: number;\n clearcoat?: number;\n clearcoatRoughness?: number;\n transmission?: number;\n thickness?: number;\n ior?: number;\n emissive?: string;\n emissiveIntensity?: number;\n opacity?: number;\n sheen?: number;\n sheenColor?: string;\n iridescence?: number;\n anisotropy?: number;\n};\n\nexport type CompatibilitySeverity = 'info' | 'warning' | 'error';\n\n/**\n * One thing the SDK could not promise to reproduce: what it is, where it\n * lives in the tree, why, and the fix, without opening a debugger.\n */\nexport type CompatibilityIssue = {\n code: string;\n severity: CompatibilitySeverity;\n message: string;\n /** `<Car>/<Body>/<Paint>`: the path a developer can actually find. */\n path?: string;\n objectId?: string;\n materialId?: string;\n materialName?: string;\n materialType?: string;\n /** Deep link into the docs. */\n docs?: string;\n};\n\nexport type CompatibilityReport = {\n /** 0 to 1. Objects that will render faithfully, weighted by triangle count. */\n score: number;\n issues: CompatibilityIssue[];\n /** Rolled up for the devtools panel and the render record. */\n counts: { info: number; warning: number; error: number };\n};\n\n// ---------------------------------------------------------------------------\n// Output and quality\n// ---------------------------------------------------------------------------\n\n/** Presets, not raw renderer settings. Most scenes need only these. */\nexport type QualityPreset = 'preview' | 'studio' | 'ultra';\n\nexport type OutputFormat =\n 'png' | 'jpeg' | 'webp' | 'exr' | 'mp4' | 'webm' | 'png-sequence';\n\n/**\n * H.264 in mp4, VP9 in webm: an encoded video, opaque, written by the\n * renderer's own muxer. Both require `manifest.animation`: there is no\n * sensible video of a still, and guessing at one is not the worker's job.\n */\nexport const VIDEO_FORMATS: OutputFormat[] = ['mp4', 'webm'];\n\n/**\n * Every frame of a clip as its own PNG, alpha kept, delivered as one\n * uncompressed tar (`render.tar`) with a `frames.json` index first. Each\n * frame is exactly what a `png` still of that pose would be: the same color\n * pipeline, the background and the shadow catcher in alpha as a still has\n * them, straight (unassociated) alpha. For a compositor that puts the\n * product between layers of its own, which an mp4 cannot feed.\n */\nexport const SEQUENCE_FORMATS: OutputFormat[] = ['png-sequence'];\n\n/** An encoded video container: opaque, one file, no per-frame alpha. */\nexport function isVideoFormat(format: OutputFormat): boolean {\n return VIDEO_FORMATS.includes(format);\n}\n\n/** One file per frame, packed in a tar. */\nexport function isSequenceFormat(format: OutputFormat): boolean {\n return SEQUENCE_FORMATS.includes(format);\n}\n\n/**\n * A format that renders every frame of `manifest.animation` rather than one\n * still: a video or a sequence. It needs an animation, it is priced at the\n * clip rate, and the format is part of what the trace produces (so it is in\n * the cache key, where a still's format is not).\n */\nexport function isClipFormat(format: string | undefined): boolean {\n return (\n format !== undefined &&\n (isVideoFormat(format as OutputFormat) ||\n isSequenceFormat(format as OutputFormat))\n );\n}\n\n/**\n * The result's file name, which is also its name in storage: the worker\n * writes it and the control plane signs a PUT for it before the render runs,\n * so both sides read it from here.\n */\nexport function outputFileName(format: OutputFormat): string {\n if (isSequenceFormat(format)) return 'render.tar';\n return `render.${format === 'jpeg' ? 'jpg' : format}`;\n}\n\n/**\n * Bits per channel of a PNG output, a still's or a sequence's frames, unless\n * `bitDepth` says otherwise. 16, so a sequence's frame is the very PNG a\n * still of that pose is, and a compositor grading it has the headroom a\n * still gives. 8 is for a pipeline that ends in 8 bits anyway: measured\n * 2026-10-03 at 1400 × 1504, it is 0.98 MB a frame against 2.24 MB, and the\n * same time to trace and write.\n */\nexport const PNG_BIT_DEPTH_DEFAULT = 16;\n\n/** The first file in a `png-sequence` tar: what the rest of it is. */\nexport const FRAME_SEQUENCE_INDEX = 'frames.json';\n\n/**\n * `frame_00000.png`, zero-based like `animation.frameCount`'s frames, so file\n * `k` is the pose a channel's `k`-th sample describes.\n */\nexport function frameFileName(frame: number): string {\n return `frame_${String(frame).padStart(5, '0')}.png`;\n}\n\n/** `frames.json`, at the head of a `png-sequence` tar. */\nexport type FrameSequenceIndex = {\n fps: number;\n frameCount: number;\n width: number;\n height: number;\n bitDepth: 8 | 16;\n /** In frame order, one per frame: `frameFileName(0)` onwards. */\n files: string[];\n};\n\nexport type OutputSpec = {\n width: number;\n height: number;\n format: OutputFormat;\n /** JPEG/WebP only, 1 to 100. */\n quality?: number;\n /**\n * PNG and `png-sequence` only: bits per channel, 16 unless 8 is asked\n * for (`PNG_BIT_DEPTH_DEFAULT`).\n */\n bitDepth?: 8 | 16;\n /** Force an opaque background even when the environment is transparent. */\n opaque?: boolean;\n};\n\n/**\n * Escape hatch under the presets. Present so an expert is never blocked,\n * absent from the quickstart so a beginner is never asked to become a\n * rendering expert to get one image.\n */\nexport type AdvancedRenderSettings = {\n samples?: number;\n maxBounces?: number;\n diffuseBounces?: number;\n glossyBounces?: number;\n transmissionBounces?: number;\n /** Adaptive sampling noise floor: the real cost dial once denoising is on. */\n adaptiveThreshold?: number;\n denoise?: boolean;\n denoiser?: 'OPTIX' | 'OPENIMAGEDENOISE';\n /** Pays for itself with many emitters, costs overhead with few. */\n lightTree?: boolean;\n /**\n * Light that reaches a surface through glass: the bright pool under a\n * tumbler, the focus line beneath a lens. Off by default: with no caustic\n * paths a transmissive object casts a solid shadow, which is also what the\n * viewport's shadow maps draw, and tracing them costs samples a product\n * shot rarely needs.\n *\n * `'soft'` lets the path tracer find caustic paths itself, with the glossy\n * filter and the indirect clamp (both of which exist to hide caustics)\n * switched off. Unbiased, and slow to converge: a hard light through\n * curved glass stays grainy at studio samples.\n *\n * `'sharp'` adds a dedicated shadow-caustic solver on top: every scene\n * lamp casts caustics, every transmissive mesh is a caster, and every\n * other mesh (the shadow catcher included) receives them. This is what\n * makes a glass on a table converge at normal sample counts. It handles a\n * single refractive object between a lamp and a surface; light from an\n * HDRI or an emissive mesh still goes the `'soft'` way.\n *\n * The solver takes over lamp light through a caster rather than adding to\n * the traced paths, and it only follows light that goes straight through.\n * A faceted stone, whose light leaves after internal reflections, comes\n * back under `'sharp'` with no caustic at all. Cut gems want `'soft'`.\n *\n * Absent is off. There is no boolean on purpose: `caustics: true` would\n * have to mean one of the two. Changes pixels, so it is in the cache key.\n */\n caustics?: 'soft' | 'sharp';\n /**\n * A ceiling on how bright one indirect sample may be, in scene radiance.\n * Absent is the renderer's own default, which `caustics` switches off: a\n * caustic's focus is a very bright indirect sample, and capping it dims\n * the focus. That is right for a still and wrong for a clip, because the\n * rare uncapped hit lands on different pixels every frame, the denoiser\n * smears each one into a soft patch, and the patches boil. For caustics\n * in motion, start at 30 (the pool under a lens is still its full\n * brightness there) and trace larger than you publish.\n *\n * Set, it wins over what `caustics` would have chosen. Changes pixels, so\n * it is in the cache key, present only when set.\n */\n clampIndirect?: number;\n /**\n * Multiplies the converted energy of every light lifted from the scene\n * graph (directional, point, spot, area and the ambient dome) and leaves\n * the HDRI environment alone. The worker's unit table is physics and stays\n * fixed; this dial is for the residual gap, where a viewport (legacy-lights\n * intensities, usually) reads brighter than the physically converted lamps\n * do. One scalar, so the ratio between the scene's lights is preserved.\n * Default 1. Changes pixels, so it is in the cache key.\n */\n lightScale?: number;\n /**\n * Ground the product with a traced shadow catcher. Defaults on for\n * transparent/solid output and off for a visible environment background.\n */\n shadowCatcher?: boolean;\n /** Catcher size, as a multiple of the model's largest dimension. */\n shadowPad?: number;\n /**\n * The renderer's view transform override. Changes pixels, so it is in the\n * cache key. Pinning one also switches off `toneCurveEmulation`: an\n * explicit name is a statement about what the render should look like.\n */\n viewTransform?: string;\n /**\n * Reproduce three's tone mapping exactly instead of substituting the\n * nearest native view transform. On by default, and it is what makes a\n * traced frame the same color as the viewport it came from.\n *\n * Turn it off to get the substitution: a wider, more forgiving curve for a\n * scene whose viewport was never the reference. Changes pixels, so it is\n * in the cache key.\n */\n toneCurveEmulation?: boolean;\n /** Seconds. The worker stops the render rather than billing an unbounded job. */\n timeoutSeconds?: number;\n};\n\n// ---------------------------------------------------------------------------\n// The manifest\n// ---------------------------------------------------------------------------\n\n/**\n * Everything one render needs, minus the bytes.\n *\n * Typically a few KB. The heavy things (the GLB, textures, the HDRI) are\n * `sha256:` references that the control plane resolves against storage the\n * SDK already filled (see asset.ts).\n */\nexport type SceneManifest = {\n protocolVersion: string;\n sdkVersion: string;\n /** The exported GLB. */\n sceneAsset: AssetHash;\n /**\n * Extra blobs this scene needs that are not inside the GLB: an HDRI, an\n * IES profile, a texture the SDK stripped out to keep the GLB cacheable.\n */\n assets?: AssetHash[];\n camera: CameraSpec;\n runtime?: RuntimeState;\n environment?: EnvironmentSpec;\n lights?: LightSpec[];\n color: ColorSpec;\n fallbacks?: MaterialFallback[];\n /**\n * Node materials, as portable shader graphs (see shader.ts). The GLB still\n * carries the mesh; the material the exporter wrote for it is a stand-in\n * that the worker replaces wholesale with the rebuilt graph.\n */\n shaders?: MaterialShaderSpec[];\n /**\n * Baked per-frame motion (see animation.ts). Present only for a video,\n * and its presence is what makes this a 3.0 manifest.\n *\n * Not inside `runtime` on purpose: runtime is the one state the\n * application was in when Render was pressed, and every field in it is a\n * single value. A sequence is a different kind of thing.\n */\n animation?: AnimationSpec;\n /**\n * A room preset around the product (see room.ts). Its geometry, lights\n * and sky are not in the GLB or in `lights`: the worker rebuilds all of it\n * from the published definition, so a product in a room uploads only the\n * product. Presence makes this a 4.0 manifest.\n */\n room?: RoomPresetSpec;\n compatibility?: CompatibilityReport;\n /**\n * What the scene weighs, measured by the SDK at capture. The control plane\n * prices with it (a dense scene traces slower per pixel and unwraps slower\n * per object), so the quote a job is accepted under is the same one\n * `estimate()` gave with the same numbers. Operational, not visual: it is\n * outside every cache key.\n */\n stats?: {\n triangles: number;\n /** Bytes of texture the manifest's shader graphs sample, when known. */\n textureBytes?: number;\n /**\n * Distinct materials that emit light: a standard material with a\n * non-black emissive color, an unlit material (rendered as emission), or\n * a node material with an emission graph. The worker turns its light\n * tree on from this. Only the SDK can count them, since the GLB's\n * materials are opaque to the control plane.\n */\n emitters?: number;\n /**\n * How much of the sky above the camera the scene's geometry hides, 0 for\n * an open set and 1 inside a closed room (`SceneComplexity`). Walls keep\n * light bouncing, which is most of what makes an interior slow to render,\n * so the quote reads it. A preset room's stand-in counts, though it is not\n * uploaded: it stands for the room the renderer builds.\n */\n enclosure?: number;\n /** Meshes the scene draws, instances counted: how full it is. */\n objects?: number;\n };\n /**\n * Where the scene came from. Diagnostics only, but \"which three version\"\n * is the first question every support conversation starts with.\n */\n source?: {\n three?: string;\n r3f?: string;\n renderer?: string;\n userAgent?: string;\n };\n};\n\n/** A manifest plus what to make from it. This is the render request body. */\nexport type RenderSpec = {\n manifest: SceneManifest;\n quality: QualityPreset;\n output: OutputSpec;\n advanced?: AdvancedRenderSettings;\n /**\n * Hard ceiling in USD. Exceeded at estimate time means the job is refused\n * before it is admitted: `RenderBudgetExceeded`, not a surprise bill.\n */\n maxCost?: number;\n /** Emit a low-sample preview partway through. On by default for `studio`. */\n preview?: boolean;\n /** Echoed on the render record and every webhook. */\n metadata?: Record<string, unknown>;\n /**\n * A resubmit with the same key returns the existing render while it is\n * running or once it has completed, never a second charge. This is what\n * makes the SDK's own retries safe. A key whose render failed, was\n * cancelled or expired is free again: nothing was charged, and the\n * resubmit renders.\n */\n idempotencyKey?: string;\n /**\n * `high` puts this render ahead of the account's other waiting work in\n * the same lane: the hero shot before the rest of the queue. It never\n * jumps a lane; a person waiting still goes first.\n */\n priority?: 'normal' | 'high';\n};\n","/**\n * Quality presets: three words instead of a renderer manual.\n *\n * The three names are the public surface. The numbers below are read by the\n * worker, the estimator and the cache key from this one table, so they\n * cannot drift apart. `version` is here because changing any number changes\n * pixels: it travels in the render record and in the render cache key, so a\n * catalog that re-renders a SKU never silently gets a different image.\n */\n\nimport type { QualityPreset } from './manifest.js';\n\nexport type QualitySettings = {\n /** Bumped whenever any number in this preset changes. */\n version: number;\n /** A ceiling, not a target: adaptive sampling decides when a pixel stops. */\n samples: number;\n /**\n * The real cost dial. With adaptive sampling on, this noise floor is what\n * ends a pixel; the renderer's own default is strict enough that most\n * pixels run to the ceiling anyway.\n */\n adaptiveThreshold: number;\n maxBounces: number;\n diffuseBounces: number;\n glossyBounces: number;\n transmissionBounces: number;\n denoise: boolean;\n /** Long edge, in px, when the caller gives no explicit output size. */\n defaultLongEdge: number;\n /** Emit a low-sample preview partway through. */\n preview: boolean;\n /** Samples for that preview. Small enough to arrive in about a second. */\n previewSamples: number;\n};\n\nexport const QUALITY: Record<QualityPreset, QualitySettings> = {\n /**\n * \"Show me roughly what this will look like.\" Cheap enough to sit inside a\n * click, noisy enough that nobody will ship it.\n *\n * No denoiser, since version 3 (2026-10-03): with it, 32 samples of a\n * product came out close to a studio render, so the cheapest tier was a\n * finished image at half the price. The grain says draft, every choice a\n * preview is for (framing, light, materials, color) still reads through\n * it, and most of a preview's time was the denoiser.\n */\n preview: {\n version: 3,\n samples: 32,\n adaptiveThreshold: 0.08,\n maxBounces: 4,\n diffuseBounces: 2,\n glossyBounces: 4,\n transmissionBounces: 4,\n denoise: false,\n defaultLongEdge: 1024,\n preview: false,\n previewSamples: 16,\n },\n\n /**\n * The default. Deep enough on glossy and transmission to carry glaze,\n * metal and glass, which is where a product shot lives, and shallow on\n * diffuse, which buys almost nothing on a product against a transparent\n * background. The threshold ends most pixels well before the ceiling; the\n * denoiser carries the noisiest ones.\n */\n studio: {\n version: 2,\n samples: 256,\n adaptiveThreshold: 0.02,\n maxBounces: 8,\n diffuseBounces: 3,\n glossyBounces: 8,\n transmissionBounces: 8,\n denoise: true,\n defaultLongEdge: 2048,\n preview: true,\n previewSamples: 24,\n },\n\n /**\n * For the hero image that goes on the homepage. Roughly 8x studio's sample\n * ceiling and a much stricter threshold.\n */\n ultra: {\n version: 1,\n samples: 2048,\n adaptiveThreshold: 0.005,\n maxBounces: 16,\n diffuseBounces: 6,\n glossyBounces: 16,\n transmissionBounces: 16,\n denoise: true,\n defaultLongEdge: 4096,\n preview: true,\n previewSamples: 32,\n },\n};\n\n/** The preset with any `advanced` overrides folded in. */\nexport function resolveQuality(\n preset: QualityPreset,\n advanced?: Partial<QualitySettings> & {\n samples?: number;\n maxBounces?: number;\n },\n): QualitySettings {\n const base = QUALITY[preset];\n if (!advanced) return base;\n return { ...base, ...stripUndefined(advanced) };\n}\n\nfunction stripUndefined<T extends object>(value: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(value).filter(([, v]) => v !== undefined),\n ) as Partial<T>;\n}\n","/** The published version. Must equal the version in package.json. */\nexport const SDK_VERSION = '0.1.0';\n"]}
|