Interface XrSessionOptions
colorFormat?: GPUTextureFormat;
depthFar?: number;
depthNear?: number;
depthStencilFormat?: GPUTextureFormat | null;
features?: readonly XrFeatureSpec[];
input?: false | XrInputCallbacks;
mode?: XrSessionMode;
onEnd?: () => void;
onFrame?: (ctx: XrSessionContext, frame: XRFrame, time: number) => void;
optionalFeatures?: string[];
referenceSpaceType?: XrReferenceSpaceType;
requiredFeatures?: string[];
}
Properties
Optionalcolor Format
Projection-layer color format. Defaults to binding.getPreferredColorFormat().
Optionaldepth Far
XR projection far-clip distance in metres. Defaults to the UA value when omitted (typically 1000).
Optionaldepth Near
XR projection near-clip distance in metres. Smaller lets objects (e.g. a
controller or a grabbed cube) come right up to the eyes without clipping.
Defaults to 0.02.
Optionaldepth Stencil Format
Projection-layer depth/stencil format handed to the compositor for reprojection.
Defaults to "depth24plus". Pass null to render without a compositor depth
attachment (Babylon Lite then renders color-only — supply your own depth if needed).
Optionalfeatures
Opt-in XR features (e.g. pointerSelection()). Their native session-feature
descriptors are merged into optionalFeatures, and each is instantiated,
driven per frame, and disposed automatically by the session.
Optionalinput
Input-source callbacks, or false to disable input tracking entirely.
Defaults to {} (sources tracked, no callbacks).
Optionalmode
"immersive-vr" (default) or "immersive-ar".
Optionalon End
Called when the session ends (user exit, exitXr, or device-driven).
Optionalon Frame
Called once per XRFrame after poses are updated and before rendering.
Optionaloptional Features
Optional feature descriptors.
Optionalreference Space Type
Reference space to render against. Defaults to "local-floor", falling back
to "local" if the device does not offer it.
Optionalrequired Features
Extra required feature descriptors (merged with the mandatory "webgpu").
Options for enterXr. All fields optional; sensible immersive-VR defaults.