threejs-webxr
/threejs-webxr
WebXR in three.js and R3F: AR placement with hit testing, VR sessions, controllers, hands, DOM overlays, XR scale and performance rules. Use when a scene opens in a headset or places a model in a room. Hands off to `web3d-model-viewer`.
- Author
- emiliodominguez ↗
- Repository
- threejs-skills ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
WebXR in three.js and R3F: AR placement with hit testing, VR sessions, controllers, hands, DOM overlays, XR scale and performance rules. Use when a scene opens in a headset or places a model in a room. Hands off to `web3d-model-viewer`.
Original author description
WebXR in three.js and R3F: AR placement with hit testing, VR sessions, controllers, hands, DOM overlays, XR scale and performance rules. Use when a scene opens in a headset or places a model in a room. Hands off to `web3d-model-viewer`.
How it works
- Process
- Anti-patterns
- Done when
SKILL.md preview
---
name: threejs-webxr
description: "WebXR in three.js and R3F: AR placement with hit testing, VR sessions, controllers, hands, DOM overlays, XR scale and performance rules. Use when a scene opens in a headset or places a model in a room. Hands off to `web3d-model-viewer`."
---
# WebXR
WebXR runs three.js scenes in headsets (immersive VR) and on phones (immersive AR with hit testing). Support is
uneven, so decide the target first:
- Android Chrome: immersive AR with hit test, anchors, DOM overlay, light estimation.
- Meta Quest browser: immersive VR and passthrough AR, controllers and hands.
- Apple Vision Pro Safari: immersive VR with hand and gaze input.
- iPhone Safari: no immersive WebXR. For "view this product in my room" on iOS, use `web3d-model-viewer`
(Quick Look), which also covers Android with less code.
## Process
1. Model scale is meters in XR, always: a 180-unit centimeter model fills the room. Inspect and fix scale first
(`threejs-model-inspect`).
2. Read the recipe for the stack: `references/vanilla.md` (three's `XRButton`/`ARButton`, `renderer.xr`) or
`references/r3f.md` (`@react-three/xr` 6: `createXRStore`, `<XR>`, hit-test hooks).
3. Render with `renderer.setAnimationLoop` only; `requestAnimationFrame` stops inside an XR session. In R3F this is
automatic.
4. Request only the session features you use (`hit-test`, `anchors`, `dom-overlay`, `hand-tracking`,
`light-estimation`); missing optional features must degrade, not crash.
5. Light AR content from the real room when possible (`XREstimatedLight` in vanilla), or at least with an
environment map, so placed models do not look pasted on.
6. Hold 72-90 fps on the headset: halve draw calls and texture sizes compared with desktop, avoid post-processing,
and keep the pixel ratio at the device default (the XR framebuffer sets it).
7. Test on the real device. Desktop browsers can emulate sessions (the Immersive Web Emulator extension), which is
fine for logic, not for comfort or performance.
## Anti-patterns
- Moving the camera in XR; the headset owns it. Move a parent of the content (or the XR origin) instead.
- Showing an "Enter AR" button without checking `navigator.xr.isSessionSupported("immersive-ar")`.
- Placing models without hit testing, so they float or sink in the room.
- Large text in 3D canvases for UI; use DOM overlay on phones and readable, world-anchored panels in headsets.
## Done when
- The session starts from a user gesture on the target devices, and unsupported devices see a fallback.
- Placed or VR content is at real-world scale and lit to match.
- Frame rate holds on the target headset for a full minute of movement.
Next: `web3d-model-viewer` when the requirement is only product AR.
Files in this package (4)
- SKILL.md 3 KB
- agents/openai.yaml 1 KB
- references/r3f.md 3 KB
- references/vanilla.md 4 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · emiliodominguez/threejs-skills | 90 | MIT |
| full-stack-skills/threejs-skills | 100 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 777753252660 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 3 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 86tinyworld-webxr
Use when adding or modifying WebXR, AR placement, VR immersion, headset controller input, or XR rendering modes in Tiny World Builder. - 100webxr-spatial
WebXR knowledge base — immersive VR/AR sessions on Quest, Vision Pro, Android (ARCore), iOS (via WebXR Viewer), spatial UI patterns, hand tracking, anchors, hit testing, controllers, `@react-three/xr`, Three.js WebXRManager. Use when targeting Quest/Vision Pro/Android AR with a… - 100threejs-impl-xr
Use when building VR or AR experiences with Three.js using WebXR. Prevents the common mistake of using requestAnimationFrame instead of setAnimationLoop, not handling controller events, or wrong reference space. Covers WebXRManager, VRButton, ARButton, controllers, hand… - 100webxr-3d-spatial-design
Technical guidelines for building immersive WebXR, Three.js, and WebGPU 3D spatial experiences. Use when implementing WebXR session management (VR/AR/inline), controller/hand tracking inputs, spatial audio, 3D UI raycasting, GLTF loading optimization, or WebGL shader performance. - 100meta-xr-sdk
Build VR/AR apps for Meta Quest (2/3/3S/Pro) — WebXR in the browser and Quest-native spatial apps. Use when building immersive WebXR with Three.js or React Three Fiber, mixed reality with passthrough, hand tracking, spatial anchors, plane/mesh detection, porting 2D apps to… - 100sceneview-web
Build 3D and WebXR (AR/VR) experiences in the browser with SceneView for Web — Filament.js (WebGL2/WASM) wrapped in a Kotlin/JS DSL and a plain-JavaScript API on `window.sceneview`. Use whenever the user asks for "3D in the browser", "a web model viewer", "WebXR AR/VR", or any…