demo · v144
Mask Inspector
A visibility mask is a triangle mesh telling the renderer which screen pixels the user can actually see through the lens. The shape is headset-specific. Pick a headset, see its mask geometry overlaid on a synthetic frame, and read off the pixel savings the GPU would skip if you respected it.
XR session: checking…
render target with mask overlay
red region = pixels the user will never see. Skip these in your fragment shader to save GPU.
numbers
vertex / index counts
the API
session.addEventListener("visibilitymaskchange", (event) => {
for (const view of event.view) {
const mask = view.visibilityMask;
// mask.vertices: Float32Array of clip-space xy positions
// mask.indices : Uint32Array indexing into vertices
uploadMaskToGPU(view.id, mask); // skip these triangles in your fragment pass
}
});