Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXR #3422

Open
6 tasks
bagnell opened this issue Jan 13, 2016 · 18 comments
Open
6 tasks

WebXR #3422

bagnell opened this issue Jan 13, 2016 · 18 comments

Comments

@bagnell
Copy link
Contributor

bagnell commented Jan 13, 2016

  • DeviceOrientationCamera, DeviceOrientationCamera  #4608
  • Future WEBGL_multiview extension?
  • The VRButton should search for VR devices. If none, are available default to Cardboard.
  • The HMDVRDevice should be passed to Fullscreen.requestFullscreen and has viewing parameters that should be used for the left and right eye cameras.
  • The PositionSensorVRDevice should be passed to DeviceOrientationCameraController to set the camera orientation. If the parameter is undefined, default to using the deviceorientation event.
  • Public API for multiple viewports, each potentially with its own camera
@bagnell
Copy link
Contributor Author

bagnell commented Jan 13, 2016

Searching for VR devices:

function enumerateVRDevices(devices) {
    var i;
    for (i = 0; i < devices.length; ++i) {
        if (devices[i] instanceof HMDVRDevice) {
                // ...
        }
    }

    for (i = 0; i < devices.length; ++i) {
        if (devices[i] instanceof PositionSensorVRDevice) {
            // Ensure devices[i].hardwareUnitId is the same as the HMDVRDevice
            // ..
        }
    }
}

if (navigator.getVRDevices) {
    navigator.getVRDevices().then(enumerateVRDevices);
} else if (navigator.mozGetVRDevices) {
    navigator.mozGetVRDevices(enumerateVRDevices);
}

@taozhi8833998
Copy link

the code just works for Oculus Rift, while not for htc vive ??

@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 8, 2017

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 5, 2018

  • WEBGL_multiview was promoted to draft and will support WebGL 1.0

@pjcozzi pjcozzi changed the title WebVR API WebXR Jun 18, 2018
@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 8, 2018

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 14, 2018

Latest from Mozilla:

We have begun work to add WebXR support to Firefox. An early implementation will be available in Firefox Nightly in the coming months, so developers and early adopters can turn it on and give it a test-drive.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 24, 2019

From WebVR/XR — The future is here:

WebXR was created to target a wider range of immersive devices beyond just VR. These include augmented reality devices (Digital content on top of the real world) such as phones, Microsoft HoloLens and Magic Leap One. WebVR had a few issues making it hard to extend to all immersive devices, so it was decided to be deprecated in favor of the WebXR API. Existing WebVR apps won’t be out of luck thanks to the WebVR polyfill which provides WebVR as long as WebXR exists.

The WebXR spec is still under development but has early experimental implementations in some browsers (e.g. Chrome Canary). The current milestone dates are here. Unfortunately, it isn’t recommended to code against yet as it is still evolving.

@mramato
Copy link
Contributor

mramato commented Sep 12, 2019

FYI: Mozilla releases WebXR emulator extensions for Chrome and Firefox so anyone can develop without needing extra hardware. Blog: https://blog.mozvr.com/webxr-emulator-extension/

Firefox: https://addons.mozilla.org/en-US/firefox/addon/webxr-api-emulator/
Chrome: https://chrome.google.com/webstore/detail/webxr-api-emulator/mjddjgeghkdijejnciaefnkjmkafnnje

@python273
Copy link

Is there a simple way to convert XRView's transform and projectionMatrix to a Camera object? I was thinking I could try to extract camera params (pos + rot + frustum) from the matrices and create a camera, but it seems hacky

@EvenJie-XR
Copy link

EvenJie-XR commented Dec 19, 2022

The VRButton should search for VR devices. If none, are available default to Cardboard.
The HMDVRDevice should be passed to Fullscreen.requestFullscreen and has viewing parameters that should be used for the left and right eye cameras.
The PositionSensorVRDevice should be passed to DeviceOrientationCameraController to set the camera orientation. If the parameter is undefined, default to using the deviceorientation event.

Hi bagnell, I would like to ask how to do these three things in webxr, because these mentioned APIs are in the outdated WebVR.
image
image
I want my vr mode to be immersive rather than a cardboard. If you can help me, I will be very grateful. Thank U~

@abigstupidbear
Copy link

any update for web-xr?
Is there a simple way to convert XRView's transform and projectionMatrix to a Camera object?

@ggetz
Copy link
Contributor

ggetz commented Mar 13, 2023

HI @abigstupidbear, there hasn't been any activity on this item recently.

If you'd like to add more information about your use case, that may help us prioritize. Or, if you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR.

I don't believe there is a way to set the Camera projection through the existing API. There would need to be change to the class itself, or camera properties would need to be set individually as we do for the existing WebVR implementation.

Thanks!

@pupitetris
Copy link

Hi. I just ran into this discussion. I have been working on a flow that truly works with WebXR. I am ready to send a PR, but only as a proof of concept. I got it working for v1.74, so I'll update my code to the latest version and then send you the proposal. Maybe a PR is not the best option for you to check it out, so please tell me if there is a better way.

@pupitetris
Copy link

pupitetris commented Jun 27, 2023

Hi. I have opened a PR as I start to work on WebXR support. This PR concretely adds displaying the VR session on the HMD using WebXR. #11372

@pupitetris
Copy link

pupitetris commented Jun 29, 2023

Is there a simple way to convert XRView's transform and projectionMatrix to a Camera object? I was thinking I could try to extract camera params (pos + rot + frustum) from the matrices and create a camera, but it seems hacky

Hey @python273 @abigstupidbear did you find any answers to this problem? I could use some help with that and get cameras working correctly for the WebXR fork of CesiumJS that I am working on. Right now we are doing this, which is not utilizing WebXR's parameters: Scene.js:prepareWebVRPose

@geotom
Copy link

geotom commented Oct 12, 2024

Hi @pupitetris, has there been any activity on this lately or what happened to your PR?

@pupitetris
Copy link

Hi. I stalled. Also, I did a mess with git and my fork is in shambles. I don't think it is a priority for Cesium to do VR through web technologies. Maybe they are focusing on Unity for VR, as there is less overhead and Cesium will run smoother on standalone headsets, I don't know.

@geotom
Copy link

geotom commented Oct 14, 2024

Hi. I stalled. Also, I did a mess with git and my fork is in shambles. I don't think it is a priority for Cesium to do VR through web technologies. Maybe they are focusing on Unity for VR, as there is less overhead and Cesium will run smoother on standalone headsets, I don't know.

Thanks for the update @pupitetris. I am currently reviewing solutions to get a georeferenced MR environment on my Meta quest, to display objects with spatial coordinates. I know there is the Cesium integration with Unity/Unreal, but when I discovered WebXR, it sounded like a much more simple way to achieve this and stay in Javascript world.

A pity, that the cesium so far does not natively support WebXR. How much work do you think it takes to get your PR in a workable state, with the current Cesium? Which commit of your fork was most stable / or from where was it starting to fall apart? I'll think I give it a try, so any help appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants