new to VR - have a problem

07 January 2017 05:20
Taking my first try at modifying a scene to view thru Oculus Rift, I added what I think is the necessary code; however while I see a stereo image in the resulting app on my browser, when I try to view the scene thru my Rift I get a frozen hourglass, blackness, sometimes a broken image, or I get kicked back to the starting VR room. Any idea what I've done wrong?
07 January 2017 15:55

Could you try to start this b4w VR example, please?

You can find this demo in SDK. You need to open main JS file (PATHTOSDK/apps_dev/space_disaster/space_disaster.js

The first requirment to get VR is correct setting stereo params in the m_app.init function:
        canvas_container_id: "main_canvas_container",
        callback: init_cb,
        console_verbose: true,
        show_fps: show_fps,
        assets_dds_available: !DEBUG,
        assets_pvr_available: !DEBUG,
        assets_min50_available: !DEBUG,
        // NOTE: autoresize doesn't work with VR-mode in GearVR, bcz there is
        // a GearVR problem!!!
        autoresize: true,

        // change scene graph
        stereo: "HMD"

Take a look at the stereo: "HMD" line

The second one is calling m_hmd.enable_hmd(m_hmd.HMD_ALL_AXES_MOUSE_NONE);
function load_cb(data_id) {
    if (m_hmd.check_browser_support()) {
         var container = m_cont.get_container();
         container.addEventListener("click", function(e) {
        // go to VR-mode in case of using HMD (WebVR API 1.0)

If your browser supports WebVR API 1.0, you can enable rendering in your device only with user action, mouse click for example
09 January 2017 07:38
OK, I'll poke around at this and see what happens. I'll have a followup question once I get this puzzled out.
23 November 2018 17:04
i have some questions about WebVR
1- i dont have any cursor in hmd mode… so i attached an object as a cursor to camera ….. i wanted to do an action when i look a specific object … i dont want to use mouse but i needed x and y coordinate for raycast…….. so i create an object and atttached it to camera and used it as a ray cast ….. and used physic for recognize the objects that i look at it….. I konw it seems crazy……
my question is … is it possible that i used ray cast in hmd
i Know that i can use second camera and append it to my main camera
canvas_x and canvas_y ===? how can i find it without mouse clicking ( i use gear vr … it has just one button to click …. which sensor should i use it)
calc_ray(camobj, canvas_x, canvas_y, destopt, nullable) → (nullable) {Parametric Line}

and i tried to use pick center but it doesn't pick really the object in middle( as i expect)

2- my second question is the quality …. i used P_CUSTOM as a quality … its really awesome i don't have anymore wavy line in the corner…. but rendering seems slow and heavy … how can i speed up it …
i reduced the size of textures… but my json file is near 800 kb and the bin file is 10.5 mb
Please register or log in to leave a reply.