pupitetris / cesium-vr

Plugin for Cesium web-based virtual globe software to support the Oculus VR headset
Other
3 stars 2 forks source link

cesium-vr

A plugin for Cesium WebGL Virtual Globe to support VR devices using a VR-enabled browser. This fork updates cesium-vr to the latest CesiumJS version and uses WebXR which is the currently best standard/proposal for the integration of VR devices for the web.

cesium-vr comes with a demo that exemplifies how to use cesium-vr:

screengrab

The source code of the demo resides in htdocs/index.js

Cloning the repo

This repo uses submodules to pull a modified version of CesiumJS. Please clone using:

git clone --recurse-submodules git@github.com:pupitetris/cesium-webxr.git

or

git clone git@github.com:pupitetris/cesium-webxr.git
git submodule init
git submodule update

Of course you can use https://github.com/pupitetris/cesium-vr.git instead of git@github.com:pupitetris/cesium-webxr.git

Usage

Please note that WebXR API specifies the restriction of not being present in the browser unless the web page is loaded through https or from localhost. This applies for both tethered and standalone setups.

Check WebXR's support table for a list of supporting web clients.

PC-VR (Tethered HMD or no HMD)

For Valve Index, HTC Vive Cosmos/Pro, HP Reverb, Varjo, etc.

Standalone HMD

For Oculus/Meta Quest, Pico, HTC Vive Focus, etc.

Final steps for both PC-VR and Stand-alone

Interaction

Legacy

Meta Quest 2

If you are having any problems, visit the WebXR Sample Pages to check you have correctly configured your VR device for use in your browser. If you're still having troubles, feel free to post an issue on the GitHub repository.

Testing

Note: obsolete info

At time of writing we have tested cesium-vr with Cesium 1.10 in Firefox Nightly 41.0a1 (2015-05-13) on Windows and OSX using the Oculus Rift Development Kit 2 and Oculus Runtime 0.5.0.1. Stereo rendering should work on other platforms but WebVR may not.

About

Stereo Rendering

To render stereo images within Cesium using a single scene and dual canvases the workflow is as follows.

For each frame:

Frustum offsetting

We have applied a small modification to Cesium's PerspectiveFrustum class. This allows us to apply the required frustum offset e.g. so the standard globe doesn't render in the center of each canvas. These modifications are currently being patched into Cesium by replacing the cameras frustum object with our implementation.

WebXR

For more information regarding WebXR or the VR-enabled browsers, check out immersiveweb.dev.

Contributing

Please let us know if you spot any errors in our implementation or have a useful extension. The best way to do this is via a pull request.

License

The cesium-vr plugin code is released under Apache 2.0 (see LICENSE.md).

This software will need you to go and acquire third party software in order to work properly; and NICTA is not suggesting that downloading and using the third party software is necessarily compliant with, or compatible with the Apache 2.0 license; and use of the third party software is entirely at the discretion (and risk) of the licensee.