HTML panels in a real room
Two HTML panels for a WebXR session that knows about the room. A tracked fingertip presses buttons the way it would on a touch screen.
The panels attach to walls and tables from plane detection and stay there with anchors. Depth sensing hides them behind real objects.
One panel can be given to the headset's compositor as an XRQuadLayer.
None of this has run on a device yet. The scene below is a simulated room that drives the same code: your pointer moves a fingertip, and the wall, table and column stand in for detected planes and a real object. The table under the demo says what a real session reports.
Show the code fingertip presses, planes, anchors, depth, quad layer
- Ask the session for the room features. Each one is optional, and the page reports which were granted.
- Give each hand's index fingertip a pointer. The tip's position is read from the hand joints every frame.
- Inside the library: a fingertip as a pointer. Distance to the panel decides hover, press and release. The ray pointer from
html3d.jsturns that into events on the element. - Put a panel on the nearest wall or table, then anchor it.
- Inside the library: planes and anchors.
- Inside the library: a panel as an XRQuadLayer. It first tries to upload the element straight into the layer's texture.
- The whole library.
Move the pointer over a panel to bring the fingertip near it, and press to push it in. Drag on the list to scroll it. Drag empty space to look around. On a phone, a touch is the fingertip.
Presses
What a session reports
Filled in while a session runs and kept after it ends. The same rows show on the status panel inside the headset.
| Feature | Simulated room | Last real or emulated session |
|---|
Checks
These move the simulated fingertip and the panels on this page, so they wait for a tap.
| Result | Experiment | Detail |
|---|
Findings
- Measured in the simulated room. A fingertip position is enough to drive DOM controls: distance to the panel gives hover, press and release, and the ray pointer from
html3d.jssupplies the events. Buttons, a slider and a scrolling list work. Snapping to a plane is a pose change, and hit testing doesn't notice because rays are mapped through UV coordinates. - Not measured: everything that needs a device. Hand joints, detected planes, anchors, the depth texture and quad layers don't exist in the browser this was written in. Each has a row in the table above that a real session fills in.
- Open: can
texElementSubImage2D()write into a layer's texture? The layer code tries it and falls back to copying the texture it already has. The "layer" row says which path ran. - Open: does
paintfire during an AR session on a phone? The "paints" row counts them. If they stop, textures are uploaded from the last paint record instead. - Depth occlusion hides pixels, not input. three.js draws the sensed depth into the depth buffer, so a panel behind a chair is not drawn there. A ray or fingertip still reaches the panel, because the page has no depth values to test against unless it asks for CPU depth.