Overview#
XRCore is a collection of classes and functions that are used to create and manage XR experiences. It is the central system for Extended Reality (XR) experiences that manages the lifecycle of XR experiences and the interactions with the scene:
XRCore manages - through a plugin system - the interaction with the VR system runtime (OpenXR, OpenVR, CloudXR etc)
It manages scheduling of the frames that need to be rendered. It splits up the pieces that need to be rendered into different views and composites them to do things like stereoscopic rendering, foveated rendering etc. It contains a compositor system that can combine multiple views into a single image.
XRCore manages the input coming from devices, such as buttons pressed, but also the poses of the controllers and head mounted displays.
XRCore manages the scheduling of polling for inputs, requesting images, updating in scene UI components and negotiates with the other components in kit sdk on how to schedule the XR experience around in.
XRCore manages a range of events that guide the business logic of the XR experience, such as switching off the selection beam etc.
XRCore contains the basic components to be build a XR UI to guide the user through the experience.
Scene partitions and the XR lifecycle#
XR reads the token attribute omni:scenePartition on /_xr/stage/xrCamera and applies it to all additional
views, including stereo and foveated views. Missing or empty values select the default partition (0).
To select a partition from the first XR frame, author the camera and its partition in a persistent USD layer (the root layer or a sublayer) before enabling the XR profile. For example:
from pxr import Sdf, Usd, UsdGeom
import omni.usd
from omni.kit.xr.core import XRCore
stage = omni.usd.get_context().get_stage()
with Usd.EditContext(stage, stage.GetRootLayer()):
camera = UsdGeom.Camera.Define(stage, "/_xr/stage/xrCamera")
camera.GetPrim().CreateAttribute("omni:scenePartition", Sdf.ValueTypeNames.Token).Set("my_partition")
XRCore.get_singleton().request_enable_profile("vr")
XR creates transient camera opinions in the session layer and removes them when disabled. Persistent partition authoring survives disable/re-enable and is read again on the first frame of each session. Do not rely on session-layer authoring to survive disabling XR.
Authoring or changing the partition after XR starts affects subsequent renders, not frames already scheduled. USD time samples are evaluated at the render frame’s timeline time, converted from seconds using the stage’s time-codes-per-second rate. XR does not write the resolved partition back to USD.