threejs-webxr
Skill9 starsChanged 54 days agoApache-2.0View on GitHub
WebXR integration for three.js: WebXRManager and XRManager on the renderer, session initialization patterns, VRButton and ARButton helpers, XRControllerModelFactory and hand model families, XREstimatedLight, XRPlanes, and related addon Webxr utilities. Use for immersive sessions and controller/hand tracking—not for standard desktop camera projection (threejs-camera) or composer post effects (threejs-postprocessing).
In this repository21 other files it gives its agents.
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- threejs-animationSkill
- threejs-audioSkill
- threejs-cameraSkill
- threejs-controlsSkill
- threejs-dev-setupSkill
- threejs-geometriesSkill
- threejs-helpersSkill
- threejs-lightsSkill
- threejs-loadersSkill
- threejs-materialsSkill
- threejs-mathSkill
- threejs-node-tslSkill
- threejs-objectsSkill
- threejs-postprocessingSkill
- threejs-renderersSkill
- threejs-scenesSkill
- threejs-texturesSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Buttons: use official button factories to create DOM entry points.
- Very specific: line 30
Renderer: call renderer.xr.enabled = true patterns per docs.
- Distinctive: line 64
When answering under this skill, prefer responses that:
- Very specific: line 67
Use setAnimationLoop patterns with threejs-renderers for XR render loops.
- Distinctive: line 68
Avoid duplicating desktop threejs-camera projection advice for XR eyes.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to use this skill
ALWAYS use this skill when the user mentions:
- Entering VR/AR,
navigator.xr, reference spaces, sessionrequestAnimationFrameloop via renderer VRButton,ARButton,XRButtoncreation patterns from examples- Controller models, hand tracking meshes, estimated real-world lighting probes
IMPORTANT: webxr vs renderers vs camera
| Topic | Skill |
| Enable XR on renderer, sizing | threejs-renderers (basics) + threejs-webxr (session) |
| Desktop projection | threejs-camera |
Trigger phrases include:
- "WebXR", "VRButton", "ARButton", "XRControllerModelFactory", "hand tracking"
- "虚拟现实", "增强现实", "沉浸式"
How to use this skill
- HTTPS requirement and feature detection for XR availability.
- Buttons: use official button factories to create DOM entry points; handle session end.
- Renderer: call
renderer.xr.enabled = truepatterns per docs; prefersetAnimationLoopfor XR loops. - Controllers: attach models via factories; read gamepad axes/buttons carefully with fallbacks.
- Hands: opt-in hand models when runtime supports; performance implications.
- Lighting:
XREstimatedLightfor AR realism—combine with threejs-lights cautiously. - Exit: restore non-XR render loop and resize handling on session end.
See examples/workflow-xr-button.md.
Doc map (official)
| Docs section | Representative links |
| Renderer XR | https://threejs.org/docs/WebXRManager.html |
| Webxr addons | https://threejs.org/docs/VRButton.html |
| Webxr addons | https://threejs.org/docs/ARButton.html |
| Webxr addons | https://threejs.org/docs/XRControllerModelFactory.html |
Scope
- In scope: Documented WebXR manager + listed addons for buttons/controllers/hands/planes.
- Out of scope: Store submission, OpenXR runtime specifics, custom native layers.
Common pitfalls and best practices
- Desktop testing requires XR emulation or hardware; fail gracefully.
- Mismatched reference space causes floor offset—validate stage vs local-floor.
- Heavy post chains may not meet VR frame time—profile aggressively.
Documentation and version
WebXR entry points span Addons → Webxr and renderer WebXRManager in three.js docs. Browser and device capabilities vary—answers should cite the official example name and three.js version when possible.
Agent response checklist
When answering under this skill, prefer responses that:
- Link
WebXRManager,VRButton,ARButton, or controller factories as relevant. - Use
setAnimationLooppatterns with threejs-renderers for XR render loops. - Avoid duplicating desktop threejs-camera projection advice for XR eyes.
- Mention reference space choice (local-floor, etc.) at a high level with docs link.
- Flag performance interaction with threejs-postprocessing in VR.
References
- https://threejs.org/docs/WebXRManager.html
- https://threejs.org/docs/VRButton.html
- https://threejs.org/docs/ARButton.html
- https://threejs.org/docs/XRControllerModelFactory.html
Keywords
English: webxr, vr, ar, xr session, controller, hand tracking, three.js
中文: WebXR、VR、AR、VRButton、手柄、手部追踪、沉浸式、three.js
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

