WebXR Mesh Detection
Overview
The WebXRMesh component enables detection and rendering of environmental surfaces like walls, floors, and furniture in AR mode. It supports two modes of operation:
- Auto-Update Mode: Automatically detects and pushes mesh changes (new/updated/removed) to the server
- RPC Mode: Server requests mesh data on-demand
Full example: vuer-examples/vuer-webxr-mesh-demo
Here's what WebXRMesh component looks like on devices that support it (e.g., Meta Quest 3):
Requirements
- WebXR-compatible device with mesh detection support (e.g., Quest 3, ARCore devices)
- WebXR session must be initialized with 'mesh-detection' feature
- Immersive-ar mode must be active
Usage
Auto-Update Mode
In auto-update mode (default), the client automatically detects mesh changes and pushes updates to the server only when changes occur:
RPC Mode
In RPC-only mode (disable auto-update), the server requests mesh data on-demand:
Note: You can also use RPC mode together with auto-update (default behavior). RPC requests work regardless of the autoUpdate setting.
Component Parameters
-
key(str): Unique identifier for the component (default: "webxr-mesh") -
color(str): Mesh material color - CSS color string or hex (optional) -
opacity(float): Material opacity for solid mesh (default: 0.15, range: 0.0-1.0) -
autoUpdate(bool): Enable automatic updates when meshes change (default: True)- When
True: Automatically sendsWEBXR_MESH_UPDATEevents when changes are detected - When
False: Only RPC mode is available for on-demand queries
- When
Data Structure
Each detected mesh contains:
vertices: Float32Array of vertex positions (x, y, z coordinates)indices: Uint32Array of triangle indicessemanticLabel: Optional semantic classification (e.g., "wall", "floor", "furniture")matrix: 16-element transformation matrix (4x4 in column-major order)