Skip to content

Performance in the headset ​

A Quest 3 is a phone chip driving two high-resolution displays. Miss a frame and the user feels it as judder. This page explains what the frame budget is, what a vue-xr-ui scene costs, and which knobs trade sharpness for GPU time.

The frame budget ​

The headset shows a new frame at a fixed rate. Your whole frame (Vue updates, layout, useXrFrame callbacks, three.js render for both eyes) must fit inside one refresh:

Refresh rateBudget per frame
72 Hz13.9 ms
90 Hz11.1 ms
120 Hz8.3 ms

<XrScene> asks for the highest rate the browser supports (the @pmndrs/xr default, frameRate: 'high'). That is the smoothest picture when the scene fits, and the tightest budget. If yours does not fit, ask for less:

vue
<XrScene :options="{ frameRate: 'mid' }">

'high', 'mid' and 'low' pick from the session's supportedFrameRates. A function (rates) => number picks one exactly.

What a vue-xr-ui scene costs ​

uikit batches its drawing. Every root (anything that lays itself out: <XrPanel>, <XrWindow>, the content of <XrFollow> or <XrHandMenu>, the popup layer of an open <XrSelect>) draws all its panels (backgrounds, borders, rounded corners) in one or two instanced meshes, and all its text in one mesh per font weight. So draw calls grow with the number of roots on screen, not with the number of buttons or lines of text. A closed dialog draws nothing.

Measured in the playground (an emulated Quest 3, one eye):

SceneRoots drawnUI draw callsAll draw calls
Main window: tabs, buttons, sliders, text169
Mixed reality: five small windows, detected planes, hands51722

Meta's guidance for Quest apps is a few hundred draw calls per frame, so the UI itself is rarely the bottleneck. Watch for these instead:

  • Each root costs three to six draw calls. Prefer one window with tabs or sections over many small floating panels.
  • Each font weight is its own atlas. A weight costs a draw call in every root that uses it and a ~160 KB WebP download the first time it shows. The default theme uses all four: body text is regular, labels medium, titles semi-bold, headlines bold.
  • Icons are meshes. <XrIcon> triangulates the strokes once and draws its own mesh. Dozens are fine; hundreds in one list are not.
  • Hidden is cheaper than off-screen. A root outside the field of view is still updated and laid out. Use v-if on windows the user closed.

Layout and reactivity ​

Layout (Yoga flexbox) runs when a layout prop changes: a size, a gap, a text that changes length. Changing a colour or an opacity does not lay out again. That gives a few rules for things that move every frame:

  • Animate the transform, not the layout. Move, turn and scale the root (position, rotation, scale), not width, margin or padding.
  • Throttle text that ticks. A clock or a sensor value that changes every frame re-lays the line every frame. Update it a few times a second.
  • Keep useXrFrame callbacks small. They run on every frame, in and out of a session. Read from refs and write to three.js objects; do not set reactive state there unless it really changed.

Scrolling (<XrList>, a scrolling <XrBox>) moves content inside the root without laying it out again.

Sharpness versus GPU time ​

<XrScene> turns on what makes text sharp, at a GPU cost (see Testing on a Quest):

OptionDefault in <XrScene>CheaperWhat you lose
frameBufferScaling'high' (native resolution)'mid', or a number such as 0.8Text softens everywhere
foveation0 (none)0.5 to 1Edges of each lens get blurry
frameRate'high''mid', 'low'Motion is less smooth

Try them in this order: frame rate first (nothing gets blurry), then foveation (the user looks through the centre), then resolution.

vue
<XrScene :options="{ frameRate: 'mid', foveation: 0.5 }">

Download size ​

  • The library is one module per component with sideEffects: false, so your bundler keeps only what you import.
  • The emulator (IWER, its device UI and rooms, about 10 MB) lives in vue-xr-ui/emulator and is loaded only when it is injected: on localhost, with no headset. See Testing in an emulator.
  • Font atlases are separate WebP files loaded on first use, cached by the browser like any image.

Measuring ​

Add ?stats to the playground or the demo app (vue-xr-vr.vercel.app/?stats, vue-xr-ui-home.vercel.app/?stats): a small panel under your view shows the frames per second against the refresh rate the session got, the average and worst frame time, missed frames and draw calls, once a second. The same panel is a few lines of useXrFrame in your own app. In the headset, Meta's OVR Metrics Tool also shows GPU load as an overlay while you use the page. On desktop, renderer.info.render.calls after a render gives the draw calls of one eye; the playground's e2e suite checks the main panel stays under its budget, so a change that breaks batching fails CI.

MIT License