Search code examples
webgloculuswebvr

Displaying web application output with Oculus rift


I have a web application which produces a 3D scene using WebGL. I am wondering whether it is possible to show this scene using Oculus rift? How difficult is it?


Solution

  • There are two major components to rendering to the Rift, head tracking and distortion.

    Distortion is normally accomplished by the Oculus SDK using either OpenGL or Direct3D, but it's possible to implement it in Javascript. You can see an example of this here. That page uses a pre-baked set of distortion vertices pulled out of the Oculus SDK, suitable for use with the DK1 model.

    Head tracking is significantly more difficult, because it requires access to the hardware, or the runtime which is talking to the hardware. Mozilla is working on a set of APIs for accessing head tracking, and possibly fetching distortion parameters, but it appears far from stable.

    Three.js appears to have examples that want to support the experimental VR apis, as well as examples that use something called ouclus-rest.

    Basically it boils down to: If you want to do VR with Javascript, you're either going to have to roll your own solution, try to hit a moving target, or have patience.