Giter Site home page Giter Site logo

meta-quest / immersive-web-emulator Goto Github PK

View Code? Open in Web Editor NEW
269.0 16.0 32.0 20.27 MB

Browser extension that emulates Meta Quest devices for WebXR development. Lead: Felix Zhang ([email protected])

Home Page: https://developer.oculus.com/blog/webxr-development-immersive-web-emulator/

License: MIT License

JavaScript 94.72% HTML 0.92% CSS 4.35%

immersive-web-emulator's Introduction

title description tags
Immersive Web Emulator
Describes how to use the Immersive Web Emulator to run WebXR apps on a desktop browser without an XR device..
WEB_PLATFORM
WEBXR

Immersive Web Emulator is a browser extension that assists WebXR content creation. It enables developers to responsively run WebXR apps on a desktop browser without the need of an XR device.

Inspired by the official WebXR Emulator Extension by Mozilla Reality and our previous efforts of extending it for better functionality, Immersive Web Emulator is designed and rebuilt from the ground up with an emphasis on full input emulation (including touch and analog input), better usability with a re-engineered UI, and more features, such as keyboard input mirroring and input session recording/playback, specifically for Meta Quest headsets.

Immersive Web Emulator

Immersive Web Emulator Features

  • WebXR API polyfill
  • 6DOF transform control for the headset and left and right controllers, powered by Three.js
  • Full input emulation support for Meta Quest Touch controllers
  • External input mirroring support for both keyboard and gamepad
  • Cross browsers support with WebExtensions API

Installation

This extension is built on WebExtensions API and implements Manifest V3. It works on Chrome, Microsoft Edge, and other browsers that support the API. The immersive Web Emulator can be installed from the following browser extension stores:

Manual Installation

For other Chromium-based browsers, you can download our latest release, and try to manually install the extension by:

  1. Download the latest release here, unpack it and note the unpacked directory.
  2. Open the Extensions page of the browser, it can typically be found in the browser menu, or you can try navigating to "chrome://extensions" in the URL bar if the browser is Chromium-based.
  3. Locate and Enable developer mode on the Extensions page.
  4. Locate and click on the Load unpacked button and select the unpacked directory from step 1.

The process may vary for different browsers.

Immersive Web Emulator Usage

After successfully installing the emulator, do the following to use Immersive Web Emulator:

  1. Go to a WebXR app page (for example, see the WebXR Examples). Notice that the app detects an XR device (emulated) and allows you to enter the immersive VR mode.
  2. Open the Immersive Web Emulator tab by going to the Chrome settings button and selcting More tools > Developer tools and looking for it on the tab bar at the top of the screen. You might need to click >> if there are many tabs. From there, you can control the emulated devices. You can move the headset and controllers, and trigger the controller buttons. You can see their transforms reflected in the WebXR application. Note that the Immersive Web Emulator tab is only available on WebXR app pages.

Device Nodes Transform Controls

By clicking a device node in the emulator's 3D viewport, you can select gizmo mode of the device. By dragging a gizmo, you can rotate or translate the device. Alternatively, you can use the following keyboard shortcut to cycle through gizmo modes of the different device nodes:

Device Node Keyboard Binding
Headset Number Key 1
Left Controller Number Key 2
Right Controller Number Key 3

Transform

Meta Touch Controller Emulated Controls

Button Action Description
Touch Toggle 'GamepadButton.touched'.
Press Set 'GamepadButton.pressed' to true and revert after 0.25 seconds.
Lock Toggle 'GamepadButton.pressed'.
Joystick Set values on 'Gamepad.axes'.
Joystick-Sticky Toggle the auto-return feature of the emulated joystick.
Joystick-Reset Recenter the emulated joystick.
Slider Emulate analog input for trigger and grip.

UI-Controls

Stereo Effect

You can enable/disable Stereo Effect which renders two views.

Pose Controls

You can save an arbitrary combination of device nodes transform data as the default starting pose of the emulator.

Keyboard Control & Events Pass-Through

There are keyboard mapping built in for some important controller emulated controls:

Button Action Keyboard Binding
Left Joystick W/A/S/D
Left Joystick Click C
Button X X
Button Y Z
Left Trigger E
Left Grip Q
Right Joystick Arrow Keys
Right Joystick Click .
Button A '
Button B /
Right Trigger Enter
Right Grip Shift

Keyboard-Controls

Keyboard events other than those reserved for controller emulation are passed through to the main WebXR experience, you may wish to utilize this feature to build in some shortcuts for debugging purposes.

Note

  • Even if native WebXR API is available the extension overrides it with WebXR polyfill

WebXR Examples

Contributing

See the CONTRIBUTING file for how to help out.

License

Immersive Web Emulator is MIT licensed, as found in the LICENSE file.

immersive-web-emulator's People

Contributors

facebook-github-bot avatar felixtrz avatar hexafield avatar mrdoob avatar raananw avatar zjm-meta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

immersive-web-emulator's Issues

Head is always at 1.75cm even when not using local floor

When using local floor, it's nice to have the head at a default normal height, but when local floor is not enabled, the head should be at height 0, because in that case if u enter VR normally that would be the case.

Having it set at 1.75 make it so I have to make work-around when the device is emulated to adjust the height of the head so not to have it super high.

Input button retains state at page load before entering immersive mode

Notice that if I press the buttons below (to switch from hands to controller or viceversa) before entering immersive mode it has no effect. It retains the option / state that had at page load. It works as expected once I enter immersive mode (I can switch from hands to controllers or viceversa)

image

gamepad axes are undefined

xrFrame.session.inputSources[n].gamepad.axes[0] can be undefined even though the gamepad object exists and is not null.

This apparently happens for the Quest Pro emulator, perhaps as a result of using a polyfill.

The Mozilla extension reports a number as required by the gamepad spec.

The reference space type is not updated until the frame after the session started

In the actual quest, the new reference type is already local floor when the session start, but with the emulator is not which is annoying and requires me to have special cases to handle the emulator if I want to test with it.

As u can see in the video, if I ask for it after the session started is properly updated to local-floor in this case.

2689.mp4

This is with Wonderland Engine

WebXR Anchors module always enabled.

The emulator doesn't require 'anchors' to be passed as optional feature to navigator.xr.requestSession

To match spec behavior. The optional feature should be required and if not available an error should be thrown when calling frame.createAnchor ...not available for this kind of session...

Screen-based AR support

I understand this may not be a priority for Meta, but I wanted to capture my thoughts here nonetheless.
We're using the simulator for AR cases as well, including phones.

A couple of behaviours differ right now that could be improved:

And some more of lower importance:

  • leaving AR sessions ends up in a bad state (this is just the case with the simulator right now but could be better I think)
  • ability to choose the environment blend mode and simulation for those modes

Cycling gizmo modes via numpad keybindings not working.

Trying to cycle the gizmo modes is not working. Tested on multiple websites.
Sorry for non-descriptive issue. I am willing to provide more info if needed.

Also is there a way to group move headset and controllers together?

Thanks for your response.

Ability to turn WebXR shim off without uninstalling the extension

Maybe I'm missing something, but seems that currently when the extension is installed it always polyfills - since we also want to test codepaths where XR is not available that's not very helpful, so I had to remove the extension again.

Could maybe be as simple as having "None" in the device dropdown?

This also extends to a note written in the docs:

Even if native WebXR API is available the extension overrides it with WebXR polyfill

which is also not really ideal... I find the extension useful but constantly uninstalling / installing it while testing something is a bit.

Record controller and hands events for later playback

To be able to integration test WebXR applications in commodity virtualized Linux containers, it would be useful if the emulator could record/save and load/playback a series of controller, hands, and plane detection events.

Being able to get this quality feedback before going to expensive on-device testing is key for scaling engineering efforts in an economically defensible way.

FWIW, we took this same approach on a game console project I worked on where we used react-native-web and injected some extra gamepad extensions, so we could get app startup profiling data and basic integration smoke test feedback before running a fuller test suite on rare prototype hardware.

Add/Remove Controller / Hand

Hi, thanks for working on this

I have two questions regarding input:

  1. I can't find an option for adding or removing controllers or hands at runtime. I'd like to be able to test the removal of one or both controllers (or one or two hands)
  2. Is it possible to mix and match hands + controllers (e.g. one hand and one controller) - It looks like this is not yet exposed to WebXR but in discussion?

Removed meshes remain in frame.detectedMeshes

I enter immersive-ar session and in the meshes tab I can add new ones (desk, lamp, ceiling). The new ones are added in frame.detectedMeshes but those I remove remain until I reload the page and enter immersive-ar again

Extension Store release?

Hey - is it planned to release this on the Chrome Extension store to make it more widely available?
Thanks!

Change mesh size

I can add / remove meshes but cannot change the size of an existing one. My understanding is that the geometry of detected meshes can change during an immersive session (lastChangedTime parameter). It would be useful if that can be also emulated.

Unexpected `press` or `selectstart` behaviour

Hi, see attached video

expected:

  • down and holding "press" button in simulator presses the button (value increases to 1) - triggering "selectstart"
  • releasing "press" button releases the button (values decreases to 0) - triggering "selectend"

actual:

  • down and holding "press" button does have no imediate effect
  • releasing "press" button increases and decreases value and triggers "selectstart" and "selectend" at once

Add a button to trigger a View Recenter event

With this I mean what happens if u long press the oculus button.
In my case, working on locomotion features, I want to recenter to actually keep the same view so it would be nice to be able to test it.

Panel no longer appears

For some reason the devtools panel no longer appears.

https://threejs.org/examples/webxr_xr_dragging

Screenshot 2023-05-08 at 19 17 16

Sometimes it does appear but it's all white.

Screenshot 2023-05-08 at 19 09 41

And when it appears and it shows the controls, changing then doesn't affect the app anymore.

Seems like something got pretty unstable... I fear it may be a collision of multiple instances of three.js in memory...?

Conflicts with older WebXR extension in Chrome

In Chrome (at least Chrome on Windows latest version) you need to deactivate the older extension or it will consume all the events and the app will not respond to headset movements in the new extension.

Feature Request: AR Mode

Hello!

This tool looks awesome! When I'm playing around with it, I see that it supports the WebXR "VR" features, but it doesn't have support for AR. Would it be possible to enable this? Maybe by providing a default "pass through" image of the user's surroundings? (As I say this, I'm thinking that there would probably need to be spatial anchors, "plane detectors", etc. which would make this significantly more complicated, especially to be as customizable as the rest of the browser extension appears to be.)

Screen Shot 2022-10-06 at 10 08 30 PM

Would be nice to not have "AR NOT FOUND"

Firefox Support

I've been a long time user of Firefox, and for a while I was able to load this extension as a temporary add-on (I assume this was before aligning it with Manifest V3). As someone with no experience in WebExtensions development, what exactly is the primary issue preventing this from working on Firefox now? From a quick skim of resources Mozilla seems to declare that they're supporting V3, but maybe you can shed some more light on the subject.

add ability to toggle XRMeshes visibility

I noticed that the emulator always renders the XRMeshes in the app viewport. It would be nice to have a way to hide them so they don't interfere with the application scene.

Bug: Errors in WebXR Samples - Controller State

When using the Controller State sample
https://immersive-web.github.io/webxr-samples/controller-state.html
First there's an error

motion-controllers.module.js:120 Uncaught (in promise) Error: No matching handedness, , in profile generic-hand
    at fetchProfile (motion-controllers.module.js:120:13)
fetchProfile @ motion-controllers.module.js:120
Promise.then (async)
(anonymous) @ input-renderer.js:248
dispatchEvent @ webxr-polyfill.js:2958
_checkInputSourcesChange @ webxr-polyfill.js:3391
XRSession$1.<computed>.onDeviceFrame @ webxr-polyfill.js:3161
requestAnimationFrame (async)
requestAnimationFrame @ webxr-polyfill.js:27152
XRSession$1.<computed>.startDeviceFrameLoop @ webxr-polyfill.js:3178
XRSession$1 @ webxr-polyfill.js:3252
requestSession @ webxr-polyfill.js:4461
await in requestSession (async)
CustomWebXRPolyfill.XRSystem.requestSession @ webxr-polyfill.js:32464
initXR @ controller-state.html:254
(anonymous) @ controller-state.html:364

image

And when entering the XR session, the hands poses are tracked, but not the joints or pinch input.

Not Enough Vertical Space

image
I go to my VR website, click on open vr and it gives this message not enough vertical space.
Tried to change the window size but didnt work.
No clue how to make this work
Chrome version 111.0.5563.148

Emulator not working with three.js and A-Frame samples

Hi, unfortunately the emulator is not working for me, with either three.js or A-Frame samples (pls see attached screenshots, tested in Edge). It does work with the babylon.js samples and the immersive-web samples. Have I done smth wrong, with the the setup, or any ideas what might be the problem here?

best regards :)

image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.