googlearchive / vrview

Library for embedding immersive media into traditional websites.
http://developers.google.com/cardboard/vrview
Apache License 2.0
1.71k stars 1.09k forks source link

Change VR viewer scanning qrcode #286

Closed michelePap closed 6 years ago

michelePap commented 6 years ago

Hi, there are only two type of cardboard viewer to choose, i want to know if is possible to scan the viewers's qrcode to load the right parameters.

Thanks

jsantell commented 6 years ago

I don't believe so -- this uses the webvr-polyfill under the hood, which only supports the 2 viewers. Do you know what values your QR code provides? Could be a way to incorporate that into the polyfill, but on Android devices, the cardboard service "remembers" your viewer, which becomes much more difficult on the web, since you'd need to rescan for every WebVR experience.

A little stumped here on a possible solution, but let me think on it and dig through some older issues on the polyfill.

michelePap commented 6 years ago

Thanks for the interest!

Do you know what values your QR code provides?

No, i just want to scan every google vr qrcode like on android, but I think it's a service not available for the web right now.

you'd need to rescan for every WebVR experience.

This is a problem that could be solved later if the scanning process is fast as on android.

michelePap commented 6 years ago

@jsantell Hi, I have found in embed.js, line 5431, how a viewer is rapresented: CardboardV1: new CardboardViewer({ id: 'CardboardV1', label: 'Cardboard I/O 2014', fov: 40, interLensDistance: 0.060, baselineLensDistance: 0.035, screenLensDistance: 0.042, distortionCoefficients: [0.441, 0.156], inverseCoefficients: [-0.4410035, 0.42756155, -0.4804439, 0.5460139, -0.58821183, 0.5733938, -0.48303202, 0.33299083, -0.17573841, 0.0651772, -0.01488963, 0.001559834] })

If i have the viewer's parameters, how can I set up a different viewer at runtime? Thanks

jsantell commented 6 years ago

It's not supported yet like I mentioned, but you might be able to get around it with copying the functionality of CardboardViewer with your own properties -- can use the module itself, but also it's a simple class you can just inline probably:

vrDisplay.deviceInfo_.setViewer(new CarboardViewer({ id: '..', ... }))

michelePap commented 6 years ago

Actually i'm doing something like that, in function CardboardVRDisplay() i put my custom viewer at this.deviceInfo_.setViewer(custom_viewer) seems that it works.

jsantell commented 6 years ago

great!