Vousk-prod. Posted March 4, 2015 Share Posted March 4, 2015 Hi everyone, Deltakosh, on 03 Jan 2015 - 8:33 PM, said: To support WebVR specification (http://blog.tojicode.com/2014/07/bringing-vr-to-chrome.html) and CardBoard devices (https://www.google.com/get/cardboard/) I tried by curiosity to put a WebVRCamera in a scene, I get the expected splitted stereo view with some fov distortion, but the camera is not moving at all, even when changing orientation of the smartphone. Is it expected behavior ?Is WebVRCamera intended to be used with a cardboard ? And how are we supposed to use it then ? Cheers Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 4, 2015 Share Posted March 4, 2015 Hi, Try the VRDeviceOrientationCamera, it has the orientation events registered. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 4, 2015 Author Share Posted March 4, 2015 Can I combine VRDeviceOrientationCamera and WebVRCamera to move the WebVR one according to impulses from VRDeviceOrientation one ?Maybe via a parenting, I will try that. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 4, 2015 Share Posted March 4, 2015 VRDeviceOrientationCamera is exactly what you are looking for: Same rendering as WebVRCamera but tied with device orientation events And yes VRDeviceOrientatonCamera is for CardBoard WebVRCamera is for Oculus for instance when used with WebVR browser (chrome, firefox) Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 Ah coool !! Hmmm, I've just tried that VRDeviceOrientationCamera but with no success, the view is not moving at all (android device, FF, Chrome and native browser).Is there something I need to activate for deviceOrientation to be computed ?http://www.babylonjs-playground.com/#NA4OQ#8 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 5, 2015 Share Posted March 5, 2015 Did you attachControl the camera? Is there error in the console? Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 ooops I didn't attachControl (I falsly presumed that canvas events listening is not applicable for this kind of camera) Now it moves !! Yeah !!But roll (alpha) is not taken in account, and pitch (beta) and yaw (gamma) are inverted... (that could be corrected by inserting the phone inside the cardboard in the other direction but that's not possible, the camera hole is on the left, and the magnet button also) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 5, 2015 Share Posted March 5, 2015 Please correct the camera directly I'll validate the PR Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 Ok.Hmm, little question : why babylon.oculusCamera.js and babylon.oculusGamepadCamera.js are duplicate in BJS/Cameras/ AND in BJS/Cameras/VR/ folders ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 5, 2015 Share Posted March 5, 2015 They should not be and will you test, please check on all devices (windows phone, android and IOS): we need to come with a portable solution:) Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 Yep we should check on every kind of devices, unfortunatly I only have android one (Samsung Galaxy S4) to test. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 Another problem : VRDeviceOrientationCamera extends OculusCamera (prototype._onOrientationEvent), but I don't have an oculus rift to check and validate any change in that class...It seems that the orientation changes come from the "regular" deviceorientation event listener... does the browser catch the plugged oculus rift's movements and convert them to deviceorientation events ? Pretty sure that alpha, beta, gamma values won't be consistent on every different kind of devices AND oculus rift... Wouldn't be less hasardous to override prototype._onOrientationEvent for the VRDeviceOrientationCamera ? Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 I've also noticed some month ago that alpha, beta, gamma values are interpreted differently on each browser Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 Oh, we'll also have to pay attention to gimbal lock problem Looks like this universal/portable VRDeviceOrientationCamera won't be an easy task, particularly for a non math-skilled people like me :lol: , but I'll try to do my best ! Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 5, 2015 Share Posted March 5, 2015 I had the same problem with this camera. I didn't play too much with the solution, but technically the screen orientation should also be taken into account. then you need to inverse the device's movement using the screen orientation data. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 5, 2015 Author Share Posted March 5, 2015 Ooops, just noticed that VRDeviceOrientationCamera already overrides prototype._onOrientationEvent... Will be easier to code, no need to change anything in parent class. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 6, 2015 Author Share Posted March 6, 2015 @RaananW: I agree we need to be as generic as possible, and taken screen orientation in account seems important for that. But if this camera is specificaly designed for cardboard, the orientation of the smartphone will always be landscape... In fact in general terms, camera designed for head mounted display VR viewing is always stereoscopic, and since we all have our two eyes on an horizontal line, it's always parallel side by side stereoscopy, which usually implies landscape mode for viewing confort.If we decide to take screen orientation in account, how will we decide when to switch from one orientation to other, do you think that people who "yawed" their head to 90° really would see their scene suddenly changing orientation ? Better to simply continue following their head movement I think.In fact this screen orientation stuff is a more complex (but interesting) problem. Should the BJS engine lock screen orientation when using this kind of camera, to avoid the browser to suddenly rotate during VR experience ? Is it possible, and is it or not too intrusive ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 6, 2015 Share Posted March 6, 2015 I'm afraid this is too intrusiveAnd for me, you should just work on VRDEviceCamera and not on parent camera Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted April 15, 2016 Share Posted April 15, 2016 On 3/5/2015 at 7:20 PM, Vousk-prod. said: @RaananW: I agree we need to be as generic as possible, and taken screen orientation in account seems important for that. But if this camera is specificaly designed for cardboard, the orientation of the smartphone will always be landscape... In fact in general terms, camera designed for head mounted display VR viewing is always stereoscopic, and since we all have our two eyes on an horizontal line, it's always parallel side by side stereoscopy, which usually implies landscape mode for viewing confort. If we decide to take screen orientation in account, how will we decide when to switch from one orientation to other, do you think that people who "yawed" their head to 90° really would see their scene suddenly changing orientation ? Better to simply continue following their head movement I think. In fact this screen orientation stuff is a more complex (but interesting) problem. Should the BJS engine lock screen orientation when using this kind of camera, to avoid the browser to suddenly rotate during VR experience ? Is it possible, and is it or not too intrusive ? Has there been any solution for this? I'd like to be able to toggle between a DeviceOrientationCamera and a VRDeviceOrientationCamera. That way the user can use their phone with or without a Google Cardboard viewer. The rotation and positioning of both camera are really buggy. I don't know enough about device orientation details to attempt it myself. With VR hitting hard this year, this seems like a missed opportunity for Babylon. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted April 15, 2016 Author Share Posted April 15, 2016 You can switch manually between the two cameras (attach/detach control) according to screen orientation (there is a dedicated js event listener if I remember well). And after deeper tests, I discovered that the problem is not really the device orientation cameras but... the devices and browsers (for instance galaxy s4 completely messed up the magnetometer data in every browsers and many native apps, but it's ok in cardboard apps because they accessed sensors differently). Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted April 15, 2016 Share Posted April 15, 2016 Correct, Vousk. I am able to attach and detach camera accordingly. They just don't play nice with all device orientations like you said. But with Babylon keeping to the theme of keeping things simple, and with the numerous amount of cameras, it'd be great if there was a VR solution that worked. For example with webvr-boilerplate with ThreeJS, there is one camera that toggles in and out of VR mode. With all of BJS's features and tools, I seriously believe that Babylon could kill ThreeJS, if only the WebVR support was better. And I think now is the time to pull ahead with VR becoming so hot. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted April 15, 2016 Author Share Posted April 15, 2016 For now WebVR is only supported by recent nightly mobile versions of Chromium and Firefox. As usual for new cool stuff, we'll have to wait it becomes a standard for a global adoption... Until that we can't do really better orientation support. Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted April 15, 2016 Share Posted April 15, 2016 Right, I totally understand that and it makes sense. It would be awesome to use the polyfill fallback that ThreeJS uses. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.