javascriptxmloculuskrpanowebvr

Unable to enter VR mode with krpano project


Description

Hello, I'm currently following krpano oculus rift tutorial. Everything about the krpano is working, except for the fact I am unable to get it to run in VR mode.

What I've tried

To get the html running in VR mode with the Oculus Rift I need to:

  1. Download and install one of the experimental web browers. I chose FirefoxNightly ( which does work with the krpanos online demos ).
  2. Add a "Enter VR" button and add an onclick to run enterVR

I've also checked and the webvr plugin is installed and active on my firefox nightly.

Errors

In my console I am getting this error when I click my button.

ReferenceError: enterVR is not defined

Questions

What am I am I doing wrong/missing for it to work?

There is this one part of the tutorial that I didn't quite understand.

Stereoscopic rendering support (output side): The stereoscopic rendering will be either enabled automatically when using the WebVR Plugin and calling the enterVR() action ...

The WeBVR Plugin is a clickable elment that links to this page. They start talking about webvr.js and possible attributes for an xml page.

<plugin name="WebVR" devices="html5" keep="true"
        url="webvr.js"
        worldscale="1.0"
        mousespeed="0.00125"
        mobilevr_support="true"
        mobilevr_ipd="63.5"
        mobilevr_screensize="auto"
        mobilevr_lens_fov="96"
        mobilevr_lens_dist="0.6"
        mobilevr_lens_vign="100"
        mobilevr_webvr_dist="false"
        mobilevr_sensor_mode="3"
        mobilevr_fake_support="false"
        vr_cursor=""
        vr_cursor_onover=""
        vr_cursor_onout=""
        onavailable=""
        onunavailable=""
        onunknowndevice=""
        onentervr=""
        onexitvr=""
        />

Does the webvr plugin ( the one that comes with firefoxnightly ) include all the above or not? If it doesn't how do I find this webvr.js and how do I include it in my project ( or firefoxnightly ) with the xml file?

These may be very simple questions, but I have been spending many hours trying to figure it out with no success. I appreciate any help. Thanks.


Solution

  • Got some help and was able to figure it out.

    Before I get started, everything I tried earlier ( and that I mentioned in the question ) was completely wrong. Forget everything I wrote and just follow this.

    Vital information

    enter image description here

    In your krpano-1.19-pr1 you'll notice a viewer folder which itself has a plugins folder. In this plugin folder you will find the following vital files necessary for your VR to function correctly:

    1. webvr.xml
    2. webvr.js
    3. webvr_cursor_80x80_17f.png

    Solution

    You need to copy these three files and place them in your generated vtour plugin's folder.

    krpano tutorial 2

    You need to open tour.xml and add two lines ( I believe you can do this before or after you modify your tour.xml file via the tour_editor.html interface ):

    <!-- webvr.xml - WebVR plugin, enter/exit VR buttons, VR cursor, VR setup -->
    <include url="%SWFPATH%/plugins/webvr.xml" />
    
    <!-- add/overwrite some settings from the webvr.xml for this example -->
    <plugin name="WebVR" mobilevr_fake_support="true" />        <!-- enable the FAKE VR support to allow testing also on desktop and tablets without VR support -->
    

    These lines need to be added at the beginning of the file after:

    <krpano version="1.18" title="Virtual Tour" onstart="startup();">
    

    krpano tutorial 3

    The two lines just tells krpano the location of the three new files you've added to your plugins folder.

    End result?

    These lines will enable you to go into VR mode. No you do not have to add a button in the tour.html file, it does that automatically now just like in the demo.

    Hope this will help others that came across the same problem.