Types Reference
ObjectBinding
The core data record for each interactive mesh in the viewer.
type ObjectBinding = {
id: string;
type?: ObjectBindingType; // defaults to "other"
modelObjectId: string;
label?: string;
group?: string;
tags?: string[];
status?: "normal" | "hidden" | "selected" | "disabled";
removed?: boolean; // deleted binding/node tombstone
visible?: boolean;
selectable?: boolean;
hoverable?: boolean;
transform?: ObjectBindingTransform;
style?: ObjectBindingStyle;
decals?: ObjectBindingDecal[]; // images and text on the surface; see ModelViewer's "Decals"
actions?: ObjectBindingAction[];
metrics?: Record<string, number>;
metadata?: Record<string, unknown>;
cameraState?: ObjectBindingCameraState;
};Key Notes
- The
objectBindingsrecord is keyed by model node identifier, not byid; unique names remain unchanged and duplicates use suffixed IDs such asCube [1] groupassigns a binding to one named set, whiletagscan assign it to several queryable setsstatusstores the authoring/domain status assigned inBindingBuildertransformstores persistent local-space position, rotation, and scale overrides; rotation values use radiansvisibleis live render state, not just an initial defaultselectable: falseandhoverable: falsemake the mesh inert to viewport picking; clicks resolve the front-most surface under the pointer, so a non-selectable mesh does not pass the click through to meshes behind itstyle.material.baseColoris the committed source of truth for color picksstyle.material.texture.pathis the committed source of truth for texture uploads- If no
texture.pathand nostyle.material.baseColorare set, the viewer falls back to the original model material - See
ObjectBindingMaterialfor the full set of per-object material overrides metricsandmetadataare displayed in the side panel as nested key/value fields (objects expand into indented child labels)cameraStatestores a saved camera view for the object; when bothpositionandtargetare set, the viewer uses that view when the object is focused or selected instead of falling back tofitToBox
ObjectBindingStatus
type ObjectBindingStatus = "normal" | "hidden" | "selected" | "disabled";This is the value stored in ObjectBinding.status and edited by
BindingBuilder’s Basics panel. Use visible, selectable, and hoverable
for the corresponding live viewer behavior.
defineObjectBindings
A runtime identity helper that validates binding literals while preserving their exact inferred TypeScript types.
import {
defineObjectBindings,
type ObjectBindingActionId,
type ObjectBindingKey,
} from "@liveroom-tech/react-immersive/utils";
const bindings = defineObjectBindings({
body: {
id: "vehicle-body",
modelObjectId: "body",
type: "body",
actions: [{ id: "repaint", label: "Repaint", type: "command" }],
},
});
type BindingKeys = ObjectBindingKey<typeof bindings>; // "body"
type BodyActions = ObjectBindingActionId<typeof bindings, "body">; // "repaint"ObjectBindingKey<T> extracts the binding-map key union. ObjectBindingActionId<T, K> extracts the declared action-id union for binding K.
ObjectBindingTransform
type ObjectBindingTransform = {
position?: [number, number, number]; // local model units
rotation?: [number, number, number]; // local Euler angles in radians
scale?: [number, number, number];
shear?: [number, number, number]; // local xy/xz/yz, between rotation and scale
pivot?: { // centered-editing reference in local space
point: [number, number, number];
offset: [number, number, number];
};
};Missing fields retain their model-authored local values. Removing the complete transform restores the model-authored position, rotation, and scale.
ModelViewer and BindingBuilder convert World/Local gizmo interactions back
into this local-space data before saving. BindingBuilder displays rotation in
degrees for authoring, but exports radians. Its transform gizmo is positioned
at the center of the object’s renderable geometry so an object can rotate around
itself even when its source node origin is offset; that temporary authoring
pivot does not modify the model file’s origin.
The viewer persists that centered-editing reference in pivot. With a pivot,
the rendered node origin is position + offset - R * H * S * point, where H
is shear. Without it, transforms keep legacy direct local position/rotation/scale
semantics. Group rotation under a non-uniform parent can require shear to retain
a rigid world-space result; preserve the exported fields rather than rebuilding
only position/rotation/scale.
ModelViewerModelEntry
An independent model in ModelViewer.models:
type ModelMergeSource = { url: string; namePrefix: string };
type ModelViewerModelEntry = {
url: string;
label?: string;
objectBindings: Record<string, ObjectBinding>;
mergeModels?: ModelMergeSource[];
sceneConfig?: SceneConfig;
originalNodePoses?: Record<string, {
position: [number, number, number];
rotation?: [number, number, number];
scale?: [number, number, number];
}>;
};URLs identify independent entries; use unique URLs and make modelUrl match an
entry. Bindings are explicit and scoped to that entry. sceneConfig supplies
inactive-slot settings; the active slot uses top-level sceneConfig.
originalNodePoses is optional reference-pose data for authored transforms.
ModelMergeSource is also accepted by single-model mergeModels; its prefix
must match the added nodes and clips used during binding authoring. Both types
are exported from the main package. See the
multiple-model reference .
ObjectBindingType
What kind of object a binding is, used to group and filter bindings (for
example hideObject({ type: "wheel" })). Any string works. The listed values
cover vehicles, rooms, furniture, characters, weapons, environment, and more,
and your editor suggests them; a domain they don’t cover can use its own, such
as "bone" or "turbine-blade". A binding without a type counts as
"other".
type ObjectBindingType =
| "body"
| "light"
| "wheel"
| "glass"
| "interior"
| "floor"
| "wall"
| "door"
| "furniture"
| "decor"
| "electronics"
| "other"
// ... and more suggestions
| (string & {}); // any other stringObjectBindingStyle
Controls the visual appearance of a mesh. All visual overrides live under
material (an ObjectBindingMaterial); there are no style-level color /
metalness / roughness fields.
type ObjectBindingStyle = {
material?: ObjectBindingMaterial;
};ObjectBindingMaterial
Per-object overrides applied on top of the mesh’s original model material as a
MeshPhysicalMaterial. Every field is optional, only the fields you set are
overridden; everything else falls back to the model-authored value. Texture slots
are { path: string } objects.
type TextureSlot = { path: string };
type ObjectBindingMaterial = {
// ── Base / PBR ──────────────────────────────────────────────
texture?: TextureSlot; // base color (albedo) map
baseColor?: string; // hex, e.g. "#ff0000"
metalness?: number; // 0–1
metalnessMap?: TextureSlot;
roughness?: number; // 0–1
roughnessMap?: TextureSlot;
reflectivity?: number; // 0–1 (specular F0)
specularIntensity?: number; // 0–1
specularIntensityMap?: TextureSlot;
specularColor?: string; // hex
specularColorMap?: TextureSlot;
// ── Emission ────────────────────────────────────────────────
emissive?: string; // hex
emissiveIntensity?: number; // 0–10
emissiveMap?: TextureSlot;
// ── Opacity / blending ──────────────────────────────────────
opacity?: number; // 0–1
alphaMap?: TextureSlot;
alphaTest?: number; // 0–1
alphaHash?: boolean;
dithering?: boolean; // banding reduction on gradients
blendingMode?: "normal" | "additive";
// ── Normal / bump ───────────────────────────────────────────
normalMap?: TextureSlot;
normalScale?: number;
flipNormalY?: boolean;
bumpMap?: TextureSlot;
bumpScale?: number;
// ── Displacement ────────────────────────────────────────────
displacementMap?: TextureSlot;
displacementScale?: number;
displacementBias?: number;
// ── Ambient occlusion ───────────────────────────────────────
aoMap?: TextureSlot;
aoMapIntensity?: number;
// ── Clearcoat ───────────────────────────────────────────────
clearcoat?: number; // 0–1
clearcoatMap?: TextureSlot;
clearcoatRoughness?: number; // 0–1
clearcoatRoughnessMap?: TextureSlot;
clearcoatNormalMap?: TextureSlot;
clearcoatNormalScale?: number;
flipClearcoatNormalY?: boolean;
// ── Sheen ───────────────────────────────────────────────────
sheen?: number; // 0–1
sheenColor?: string; // hex
sheenColorMap?: TextureSlot;
sheenRoughness?: number; // 0–1
sheenRoughnessMap?: TextureSlot;
// ── Anisotropy ──────────────────────────────────────────────
anisotropy?: number; // 0–1
anisotropyRotation?: number; // radians
anisotropyMap?: TextureSlot;
// ── Transmission / volume ───────────────────────────────────
transmission?: number; // 0–1
transmissionMap?: TextureSlot;
thickness?: number;
thicknessMap?: TextureSlot;
attenuationColor?: string; // hex (volume tint)
attenuationDistance?: number;
// ── Faces ───────────────────────────────────────────────────
side?: "front" | "back" | "double";
};Texture color space
Texture slots are decoded with the correct color space automatically, so maps render at the right brightness:
- sRGB (color) maps:
texture(base color/albedo),emissiveMap,sheenColorMap,specularColorMap - Linear (data) maps: everything else,
normalMap,roughnessMap,metalnessMap,aoMap,displacementMap,bumpMap,alphaMap,clearcoat*Map,anisotropyMap,transmissionMap,thicknessMap,sheenRoughnessMap,specularIntensityMap
The shared texture cache is keyed by URL and color space, so the same image URL can be used safely as both a color map and a data map.
The package exports MATERIAL_SIDES (["front", "back", "double"]) and
MATERIAL_BLENDING_MODES (["normal", "additive"]) for building typed UI
controls without duplicating these option lists.
ObjectBindingAction
Defines an action button shown in the side panel.
type ObjectBindingAction = {
id: string;
label: string;
type: "command";
effects?: ObjectActionEffect[];
};effects are executed in declaration order by useViewerActions. Each effect updates one concern through the corresponding library controller:
type ObjectActionEffect =
| {
target: ObjectBindingTarget;
objectBindings: ObjectBindingPatch;
}
| { sceneConfig: SceneConfigPatch }
| {
target: ObjectBindingTarget;
visibility: "show" | "hide" | "toggle";
}
| { camera: CameraAction }
| { animation: AnimationAction };
type CameraAction =
| { type: "focus-object"; objectId?: string }
| { type: "fit-scene" }
| { type: "reset" }
| { type: "set-target"; target: [number, number, number]; transition?: boolean }
| { type: "set-state"; state: ViewerCameraState; transition?: boolean };
// play replaces the clips already playing unless alongside is set; the others
// act on clip, or on every active clip when it's left out.
type AnimationAction =
| ({ type: "play"; clip: string } & AnimationPlayOptions)
| { type: "pause"; clip?: string }
| { type: "stop"; clip?: string }
| { type: "set-speed"; speed: number; clip?: string }
| { type: "seek"; time: number; clip?: string };ObjectBindingTarget supports an object id, an array of ids, { group }, { tag }, or { type }.
Built-in action IDs:
| ID | Behavior |
|---|---|
toggle-visibility | Toggle mesh visibility |
change-color | Open color picker |
change-material | Open texture upload |
ObjectBindingCameraState
Saved camera state for zooming to an object.
type ObjectBindingCameraState = {
position?: [number, number, number];
target?: [number, number, number];
fov?: number;
zoom?: number;
};When both position and target are set on a binding’s cameraState, the viewer uses that saved view when the object is focused or selected instead of falling back to fitToBox.
ObjectActionEvent
The event shape emitted by onAction and useViewerActions.runAction.
type ObjectActionEvent = {
objectId: string;
action: ObjectBindingAction;
binding?: ObjectBinding;
screenX?: number;
screenY?: number;
};ObjectPointerEvent
The event shape passed to onObjectDoubleClick and onObjectContextMenu.
type ObjectPointerEvent = {
binding: ObjectBinding;
clientX: number; // viewport coordinates, e.g. for a position: fixed menu
clientY: number;
pointerType: string; // "mouse" | "pen" | "touch"
surface?: { position: Vec3; normal: Vec3 }; // where on the object, in its own space
};AnimationControls
Provided via onAnimationsReady. In multi-model mode that callback
follows the active model. onModelAnimationsReady(url, controls) provides the
same interface independently for every slot; clip names are local to its URL.
type AnimationPlayOptions = {
alongside?: boolean; // keep the clips already playing (default false: replace them)
fade?: number; // seconds to fade in, and to fade out the clips it replaces
reverse?: boolean; // play backwards, from where the clip is or from its end
};
type AnimationClipState = {
clip: string;
status: "playing" | "paused" | "finished"; // finished: a play-once clip holding its last pose
time: number; // seconds
duration: number; // seconds
speed: number;
reverse: boolean;
};
type AnimationPlaybackState = {
currentClip: string | null; // the clip played most recently, while it's active
isPlaying: boolean; // whether any clip is playing
speed: number; // speed, position and length of currentClip
time: number;
duration: number;
active: AnimationClipState[]; // every active clip, most recently played last
};
// Leave out clipName to act on every active clip.
type AnimationControls = {
clips: string[];
clipDetails?: { sourceName: string; duration: number }[];
play: (clipName: string, options?: AnimationPlayOptions) => void;
pause: (clipName?: string) => void;
stop: (clipName?: string) => void; // stops and resets the pose
setSpeed: (speed: number, clipName?: string) => void;
seek?: (time: number, clipName?: string) => void; // absolute time, in seconds
getState?: () => AnimationPlaybackState;
subscribe?: (listener: (state: AnimationPlaybackState) => void) => () => void;
};ViewerIsolation
ModelViewer’s isolation prop. See
Isolating objects .
type ViewerIsolation = {
target: ObjectBindingTarget; // an id, a list of ids, { group }, { tag }, or { type }
mode?: "ghost" | "hide"; // default "ghost"
ghostOpacity?: number; // 0–1, default 0.12
};SceneSectionConfig
sceneConfig.section. See
showSectionTools.
type SceneSectionConfig = {
enabled: boolean;
axis: "x" | "y" | "z"; // world axis the cut runs across
position: number; // 0 at the model's minimum along the axis, 1 at its maximum
flip: boolean; // keep the higher side instead of the lower one
};DEFAULT_SECTION_CONFIG is { enabled: false, axis: "y", position: 0.5, flip: false }.
SceneStyleRule
The rules in sceneConfig.styleRules, applied in order. See
Style rules .
type SceneStyleRule = {
id: string;
label?: string;
target?: ObjectBindingTarget; // every bound object when left out
when?: SceneStyleCondition | SceneStyleCondition[]; // all must match
material?: ObjectBindingMaterial;
colorScale?: SceneStyleColorScale;
pulse?: boolean | SceneStylePulse;
};
type SceneStyleCondition =
| { metric: string; above?: number; below?: number }
| { status: ObjectBindingStatus | ObjectBindingStatus[] }
| { metadata: string; equals: string | number | boolean | null }; // "a.b" reaches nested keys
type SceneStyleColorScale = {
metric: string;
stops: [number, string][]; // [value, "#rrggbb"]
channel?: "baseColor" | "emissive"; // default "baseColor"
};
type SceneStylePulse = {
color?: string; // default "#ff3b30"
speed?: number; // pulses per second, default 1
};SceneLight
type SceneLightAttachment = {
objectId: string;
offset: [number, number, number];
};
type SceneLight = {
id: string;
type: "none" | "directional" | "point" | "spot" | "hemisphere";
color: string;
intensity: number;
position: [number, number, number];
rotation?: [number, number, number];
distance?: number;
decay?: number;
angle?: number;
penumbra?: number;
attachedToCamera: boolean;
attachment?: SceneLightAttachment;
castShadow: boolean;
shadowBias: number;
visible: boolean;
};position and rotation are world-space unless the light is attached.
rotation uses Euler radians and controls directional/spot-light orientation.
An attachment resolves
binding keys, binding ids, modelObjectId values, and raw model node names. Its
offset uses the target object’s local space. distance and decay apply to
point and spot lights; spot lights also use angle (radians) and penumbra
(0–1).
SceneModelRenderer
Selects the whole-model material renderer used by SceneConfig.model.renderer.
type SceneModelRenderer = "pbr" | "matcap" | "uv-checker";"pbr"renders the model-authored and binding-overridden physical materials."matcap"renders a lighting-independent studio material."uv-checker"renders a numbered directional UV0 test chart. Meshes without UV0 coordinates appear magenta.
SceneConfig
The complete serializable scene state consumed by ModelViewer.sceneConfig,
authored by BindingBuilder, and managed by useSceneConfig.
type SceneConfig = {
model: {
rotation: [number, number, number];
showAdvancedRotation: boolean;
renderer: "pbr" | "matcap" | "uv-checker";
shading: "lit" | "unlit" | "normals";
autoRotate?: boolean;
autoRotateSpeed?: number;
activeVariants?: string[]; // glTF material variants shown, one per option group
};
camera: SceneCameraConfig;
lighting: SceneLightingConfig;
wireframe: SceneWireframeConfig;
shadows: SceneShadowConfig;
environment: SceneEnvironmentConfig;
background: SceneBackgroundConfig;
groundShadows: SceneGroundShadowConfig;
postProcessing: ScenePostProcessingConfig;
animations: SceneAnimationConfig;
annotations: SceneAnnotationMarker[];
cinematic?: SceneCinematicConfig;
styleRules?: SceneStyleRule[]; // data-driven looks; see ModelViewer's "Style rules"
section?: SceneSectionConfig; // cut-away view; see ModelViewer's showSectionTools
};model.autoRotate and model.autoRotateSpeed apply when the equivalent
ModelViewer props aren’t passed; passed props win. model.activeVariants
selects the model’s glTF material variants by name, at most one from each
option group (see
showMaterialVariants). Import
DEFAULT_SCENE_CONFIG when creating a scene from code so new sections and
defaults remain populated, then update it with useSceneConfig or
patchSceneConfig. For lighting.lights, sceneLight({ id, ...settings })
builds a complete light, filling in the settings you leave out.
3D Tiles types
ViewerObjectInfo
onObjectCatalog receives one entry for every bindable object in the model,
whether it’s loaded whole or streamed:
type ViewerObjectInfo = {
name: string; // the key to use in objectBindings
triangles: number;
minimum: [number, number, number];
maximum: [number, number, number];
};minimum and maximum are the object’s bounds in the model’s own units, in
Z-up coordinates as in 3D Tiles: a point at glTF (x, y, z) is (x, -z, y)
here. They don’t change when the viewer moves or scales the model.
CinematicConfig
Configures the cinematic auto-camera on ModelViewer.
type CinematicConfig = {
waypoints?: CinematicWaypoint[]; // camera keyframes to glide through
duration?: number; // seconds for one full pass (auto-scales when omitted)
loop?: boolean; // default true
autoPlay?: boolean; // start once the model has loaded and framed (default false)
};
type CinematicWaypoint = {
position: [number, number, number];
target: [number, number, number]; // world-space look-at point
azimuthAngle?: number; // radians, captured by BindingBuilder; omit by hand
polarAngle?: number; // radians
segmentDuration?: number; // seconds spent reaching the next waypoint
};With fewer than two waypoints the camera falls back to an auto-generated orbit around the model’s bounding sphere.
SceneCinematicConfig
The persisted form of the cinematic path carried on SceneConfig.cinematic, authored visually in BindingBuilder’s Cinematic tab.
type SceneCinematicConfig = {
enabled: boolean; // turns the auto-camera on at runtime
waypoints: SceneCinematicWaypoint[];
duration?: number;
loop: boolean;
autoPlay: boolean;
};
type SceneCinematicWaypoint = {
position: [number, number, number];
target: [number, number, number];
azimuthAngle?: number; // radians, captured by BindingBuilder; omit by hand
polarAngle?: number; // radians
segmentDuration?: number;
};ModelViewer activates a sceneConfig-authored path when enabled is true and there are at least two waypoints. The cinematic prop overrides it field-by-field.
CustomObjectBindingDataPanelProps
Props passed to a customObjectBindingDataPanel render prop.
type CustomObjectBindingDataPanelProps = {
isOpen: boolean;
selectedObject: ObjectBinding | null;
currentAction: ObjectActionEvent | null;
onClose: () => void;
onAction: (event: ObjectActionEvent) => void;
};CustomSceneObjectsPanelProps
Props passed to a customSceneObjectsPanel render prop.
type CustomSceneObjectsPanelProps = {
objectBindings: Record<string, ObjectBinding>;
onAction?: (event: ObjectActionEvent) => void;
onFocus?: (binding: ObjectBinding) => void;
onHover?: (binding: ObjectBinding | null) => void;
};CaptureVideoOptions
Options for ViewerReadyState.captureVideo, useViewerConnection().captureVideo,
and useViewer().connection.captureVideo. The result is a video Blob in the
browser-supported format. See Video export
for readiness requirements and recording behavior.
type CaptureVideoOptions = {
/** Defaults to cinematic when a path is enabled, otherwise turntable. */
mode?: "cinematic" | "turntable";
/** Auto prefers WebM, then MP4. "gif" makes a looping GIF. Explicit formats reject if unsupported. */
format?: "auto" | "webm" | "mp4" | "gif";
/** Seconds per pass, in (0, 300]. Defaults to path timing, or a 24s orbit (8s for a GIF). */
duration?: number;
/** Capture frame rate, from 1 to 60. Default 30 (15 for a GIF). */
fps?: number;
/** Encoder target bitrate in bits per second. Default 8,000,000. Not used for GIFs. */
videoBitsPerSecond?: number;
/** GIF width in pixels, 16 to 4096, never wider than the canvas; the height follows. Default 480. */
gifWidth?: number;
/** Aborting discards the recording and restores the viewer. */
signal?: AbortSignal;
};ViewerEngagementEvent
The discriminated event union received by ModelViewer.onEngagement. Narrow on
event.type to access event-specific fields. See
Engagement analytics
for event triggers, opt-in logging, and session semantics.
/** Engagement from deliberate viewer interactions, with model/session context. */
type ViewerEngagementEvent = {
/** Ephemeral identifier for this viewer/model session; no persistent storage. */
sessionId: string;
/** ISO timestamp of the event. */
timestamp: string;
/** Milliseconds since tracking started for this model. */
elapsedMs: number;
modelUrl: string;
tilesetUrl: string | null;
} & (
| {
type: "part-viewed";
objectId: string;
objectKey: string;
label?: string;
source: "canvas" | "panel" | "keyboard";
}
| {
type: "variant-chosen";
variant: string | null; // null when a group's choice was cleared
previousVariant: string | null; // the group's previous choice
group: string | null; // the option group's name; null for an unnamed group
}
| { type: "ar-started" }
| {
type: "ar-ended";
durationMs: number;
reason: "session-ended" | "interrupted";
}
| {
type: "ar-launch-requested";
channel: "quick-look" | "mobile-handoff";
}
| { type: "tour-started"; annotationCount: number }
| { type: "tour-completed"; annotationCount: number; durationMs: number }
| {
type: "tour-stopped";
annotationCount: number;
durationMs: number;
reason: "stopped" | "restarted" | "annotations-changed" | "interrupted";
}
);
SceneAnnotationMarker
type SceneAnnotationCameraView = {
position: [number, number, number];
target: [number, number, number];
azimuthAngle?: number; // radians
polarAngle?: number; // radians
fov?: number | null;
zoom?: number;
};
type SceneAnnotationImage = { src: string; alt?: string };
type SceneAnnotationLink = { href: string; label: string };
type SceneAnnotationMarker = {
id: number;
worldPosition: [number, number, number];
localPosition: [number, number, number];
worldNormal?: [number, number, number];
anchorNodeName?: string;
anchorLocalPosition?: [number, number, number];
title: string;
description: string;
cameraView?: SceneAnnotationCameraView;
images?: SceneAnnotationImage[];
links?: SceneAnnotationLink[];
category?: string;
minDistance?: number;
maxDistance?: number;
};All rich fields are optional. See Rich annotations for saved-view playback,
category filtering, and marker-distance behavior. These annotation types are
exported from the main entry and the server-safe /utils entry.
Measurements
Available from the main package and the server-safe
/utils entry. See calibration and persistence
for the viewer controls and callbacks.
| Type | Purpose |
|---|---|
MeasurementUnit | "m", "cm", "mm", "in", or "ft" |
MeasurementSettings | Optional sourceUnit, displayUnit, and calibration override metersPerUnit |
MeasurementTool | "distance", "angle", "area", "pointToPlane", "wrap", or "wrapHorizontal" |
MeasurementPosition | Three-number coordinate tuple |
MeasurementPoint | Numeric ID, world position, optional normal/face vertices, snapping mode, and anchor |
MeasurementAnchor | Mesh ID, local coordinates, optional instance index, geometry fingerprint, and pose fingerprint |
SavedMeasurement | String ID, name, stable modelId, tool, points, ISO createdAt, optional visibility and approximate-LOD flag |
MeasurementCollection | { settings: MeasurementSettings; items: SavedMeasurement[] }, stored in SceneConfig.measurements |
MeasurementStatus | "ready", "approximate", "model-changed", "missing-object", "geometry-changed", "pose-changed", "hidden-object", or "invalid" |
MeasurementResult | ID, status, raw value, converted value, and unit. Values are nullable for stale/invalid records |
The same entries export these utilities:
import {
calibrateMeasurements,
measurementResult,
measurementScale,
measurementValue,
measurementsToCsv,
parseMeasurements,
serializeMeasurements,
type MeasurementCollection,
} from "@liveroom-tech/react-immersive/utils";
const settings = calibrateMeasurements(100, 2, "m", { displayUnit: "cm" });
const collection: MeasurementCollection = { settings, items: [] };
const scale = measurementScale(settings); // factor: 2 (model units to cm)
const restored = parseMeasurements(serializeMeasurements(collection));
const csv = measurementsToCsv(restored);MEASUREMENT_UNITS lists the five supported units. measurementValue(tool, points) computes raw geometry and its dimensionality; measurementResult
converts one saved record and returns its status. parseMeasurements accepts
an object or JSON string, validates it, and returns detached data.
serializeMeasurements adds the file format’s version: 1.
measurementsToCsv(collection, liveResults?, legacyUnit?) accepts resolved
results when anchors have moved; without them it uses each record’s stored
world coordinates. The built-in CSV exporter resolves current anchors first.
Hierarchy and saved selections
Available from the main entry and /utils:
type ViewerHierarchyNode = {
id: string;
parentId: string | null;
name: string;
objectId?: string; // Binding-compatible identifier on a named mesh.
};
type SceneSelectionSet = {
id: string;
name: string;
objectIds: string[]; // modelObjectId values, scoped to the owning model.
};collectObjectHierarchy(root) returns an ordered flat tree with parent links,
including source groups and ancestors of bindable meshes. Tree row IDs describe
structural paths; use objectId for bindings and persisted selections. Models
with duplicate mesh names use the same stable suffixed IDs as object bindings.
parseSelectionSets(input) validates and detaches an array of up to 128 named
sets. SceneConfig.selectionSets is optional and belongs to one model.
import {
copyBindingStyle,
pasteBindingStyle,
type ObjectBinding,
} from "@liveroom-tech/react-immersive/utils";
export function matchDoorStyles(bindings: Record<string, ObjectBinding>) {
const source = bindings.FrontDoor;
if (!source) return bindings;
const style = copyBindingStyle(source);
return pasteBindingStyle(bindings, { type: "door" }, style);
}Style snapshots contain authored material overrides only. Paste replaces target styles, skips removed objects, and preserves all non-style fields. Both helpers return detached nested style data so editing one target cannot mutate the clipboard or another target. Application-owned state/history decides when to commit the returned batch.
Other exported types
Every type below is exported from @liveroom-tech/react-immersive and is
described with the API it belongs to.
| Types | Described with |
|---|---|
ModelViewerModelEntry, ModelMergeSource | Multiple models |
ModelViewerProps, ModelViewerPreset, GroupedModelViewerProps, ModelViewerUiOptions, ModelViewerToolsOptions, ModelViewerControlsOptions, ModelViewerPerfOptions, ModelViewerTilesOptions, ModelViewerXrOptions, ModelViewerDecoderOptions, ObjectTransformSpace, TexturePositioningControls, XRScaleMode, ModelFormat, AnnotationMarker, CameraLimits, CameraControllerType, MouseControllerPosition, PerformanceProfile, ViewerObjectInfo | ModelViewer |
SimpleModelViewerProps (from /simple-model-viewer) | SimpleModelViewer |
BindingBuilderProps (from /binding-builder) | BindingBuilder |
ObjectBindingMaterialBlendingMode, ObjectBindingMaterialSide, ObjectBindingTextureSlot, ObjectBindingTextureChannel | ObjectBindingMaterial |
AnimationActionEffect, CameraActionEffect, ObjectBindingsActionEffect, SceneConfigActionEffect, VisibilityActionEffect | ObjectBindingAction |
AnimationLoopMode, SceneAnimationClipConfig, SceneLightType, SceneModelConfig, SceneCameraConfig, SceneLightingConfig, SceneShadowConfig, SceneEnvironmentConfig, SceneWireframeConfig, SceneBackgroundConfig, SceneGroundShadowConfig, ScenePostProcessingConfig, EnvironmentPreset, GlitchModeName, KernelSizeName, RampTypeName | SceneConfig and SceneLight |
SceneAnnotationMarker, SceneAnnotationCameraView, SceneAnnotationImage, SceneAnnotationLink | SceneAnnotationMarker |
MeasurementUnit, MeasurementTool, MeasurementPosition, MeasurementSettings, MeasurementAnchor, MeasurementPoint, SavedMeasurement, MeasurementCollection, MeasurementStatus, MeasurementResult | Measurements |
ObjectBindingDecal, ObjectSurfacePoint | Decals |
MaterialVariantGroup, MaterialVariantOption (also from /simple-model-viewer and /utils) | showMaterialVariants |
ReducedMotionSetting (also from /simple-model-viewer and /utils) | reducedMotion |
RendererBackend (also from /utils) | webgpu |
ViewerLoading, ViewerReveal (also from /simple-model-viewer) | Lazy loading and posters |
CompareViewerProps, CompareViewerSide | CompareViewer |
ViewerIsolation, IsolatedObjectBindings | ViewerIsolation |
ViewerIsolationProps | useViewerIsolation |
SceneSectionConfig, SceneSectionAxis, SceneSectionSettings, SceneSectionPlane, SceneSectionPreset | SceneSectionConfig |
SceneStyleRule, SceneStyleCondition, SceneStyleColorScale, SceneStylePulse | SceneStyleRule |
StyledObjectBindings, StyledObjectPulse | applyStyleRules, see Style rules |
HiddenObjectsState, ObjectBindingsController, BindingEdit, ObjectBindingSelector, DeepPartial | useObjectBindings |
ViewerSelectionProps | useViewerSelection |
ViewerHierarchyNode, SceneSelectionSet | Hierarchy and saved selections |
ViewerHoverProps | useViewerHover |
ShareableViewerState, ViewerConfiguration, ViewerStateStorage, ShareableViewerStateProps, UseShareableViewerStateOptions | useShareableViewerState |
ViewerModelBounds, ViewerModelInfo, ViewerModelProps | useViewerModel |
ViewerActionAnimationController, ViewerActionBindingsController, ViewerActionCameraController, ViewerActionSceneController, ViewerActionsOptions, ViewerActionsProps | useViewerActions |
HomeCameraState, ViewerCameraConfig, ViewerCameraProps, UseViewerCameraOptions | useViewerCamera |
ViewerConnectionController, ViewerReadyConsumer, ViewerReadyHandler | useViewerConnection |
AnimationClipInfo, AnimationClipState, AnimationClipStatus, AnimationPlayOptions, ViewerAnimationsProps | useViewerAnimations |
RuntimeMaterialPatch, RuntimeMaterialRanges, RuntimePointLightOptions, RuntimePointLightPatch, RuntimeTransformPatch, RuntimeTransformRanges, UseViewerEffectsOptions, ViewerEffectEasing, ViewerEffectsController, ViewerEffectRange, ViewerEffectTarget, ViewerFlickerOptions, ViewerLightEffectChannel, ViewerMaterialEffectChannel, ViewerTimelineOptions, ViewerTimelineStep, ViewerPulseOptions, ViewerTransformEffectChannel, ViewerTransitionOptions, ViewerVector3 | useViewerEffects |
ModelViewerLabels / ModelViewerLabelKey
ModelViewerLabelKey is the union of keys in DEFAULT_MODEL_VIEWER_LABELS.
ModelViewerLabels is Partial<Record<ModelViewerLabelKey, string>>, accepted by both viewers’ labels prop. The default dictionary and both types are exported from the main package, /simple-model-viewer, and /utils (which can be imported without React).
See the labels reference for examples and the complete catalog.
Product configuration types
Development SDK exports include ProductDefinition, ProductOptionGroup,
ProductOption, ProductOptionRef, ProductOptionRule, ProductAppearance,
ProductSku, ProductSelections, SceneProductConfig, ProductConfiguration,
ProductConfigurationIssue, ProductOptionState, ProductAvailability,
ProductPrice, ProductCommerceAdapter, ProductCommerceContext,
ProductCheckoutContext, and ProductCommerceResult (main and /utils).
ProductConfigurator, UseProductConfiguratorOptions and ProductOptionsProps
are exported from the main package. SceneConfig.product optionally holds
{ definition: ProductDefinition, selections: ProductSelections }.
See useProductConfigurator
for complete schema examples, adapter contracts and serialization behavior.
Asset diagnostics types
Data types AssetDiagnosticIssue, AssetDiagnosticsSource,
AssetTextureDiagnostic, AssetDiagnosticsReport, InspectAssetOptions,
StreamingDiagnostics, and ViewerRuntimeStats are exported from the main
package and /utils. AssetDiagnosticsPanelProps is exported from the main
package. See Asset Diagnostics
for the report and callback contracts.
Asset placement types
The package exports AssetTransform from the main and /utils entries,
with parseAssetTransform, snapAssetToGrid and groundAsset.
See Multi-asset composition .
AR handoff types
The package exports ARHandoffOptions, ARHandoffRequest,
ARHandoffStatus, ARExportOptions, ARSnapshotSource and ARSnapshot from the
main and /utils entries. See Configuration-preserving AR
for preparation, adapter, snapshot and URL contracts.
Visual sequence types
SceneConfig.sequences?: SceneSequence[] stores timed tracks.
SceneSequence, SequenceTrack, SequenceTarget, SequenceKeyframe,
SequenceValue, SequenceCameraView, SequenceVector3, SequenceObjectProperty,
SequenceEasing, SequenceControls and SequencePlaybackState are exported from
the main and /utils entries. ViewerSequencesProps is a main-entry type.
See Visual sequence authoring
and useViewerSequences .
Semantic comparison types
The main entry exports SemanticComparisonOptions, ConfigurationComparisonInput,
ConfigurationComparisonReport, ComparisonObject, ComparisonChange,
ComparisonCategory, ComparisonStatus, and ComparisonHighlight. The data-only
/utils entry also exports them. See
Semantic comparison .
ModelViewerProps.comparisonHighlights accepts { objectId, color }[] to draw
transient bounds on the active asset without changing its materials.
Advanced section types are SceneSectionSettings (the original fields plus
optional mode, normal, planes, activePlaneId, box, invertBox),
SceneSectionPlane (id, name, enabled, axis, position, flip, optional
normal), and SceneSectionPreset (id, name, settings).
SceneSectionConfig is SceneSectionSettings & { presets?: SceneSectionPreset[] }.