demo · v144

Visibility Mask Simulator

Pick a headset profile to swap the visibility mesh. The canvas renders one eye's viewport — the colourful region is what the lens actually shows; the muted overlay is what XRVisibilityMaskChange tells the page it can stop shading. Pixel savings show in the stats.

To run this for real, enter an immersive WebXR session on a headset that publishes a visibility mask. Without one, the demo simulates the mask in a 2D canvas so the optimisation is still visible.

WebXR + XRVisibilityMaskChange: checking…

visible pixels
masked pixels
% saved
events fired0

the API

session.addEventListener('visibilitymaskchange', (e) => {
  // e.view.visibilityMask — Float32Array vertices, Uint16Array indices
  shader.setUniform('uMask', e.view.visibilityMask);
});

see also