Quantcast
Channel: Bugs Latest Topics
Viewing all articles
Browse latest Browse all 760

VR rig cameras not separated, no 3D effect

$
0
0

Hi! Pardon me as my first post happens to be a bug report. I just learnt Babylon.js last week, am going through the tutorials, and it's a really great framework!

So coming on to the bug report: I am using a VRDeviceOrientationFreeCamera but it seems the left and right rig cameras are in exactly the same position, with no offset distance between them. As a result, although there are two viewports, the images are exactly the same. Using a Google Cardboard, the image appears flat and not 3D. See attached screenshot below.

Please also refer to Babylon.js playground http://www.babylonjs-playground.com/#ZTRL5#30

In the Playground and the screenshot, you can see that the line of vertical sticks along the Z axis are aligned in both viewports. If there is an offset between the 2 cameras, the sticks should not be aligned.

 

Screenshot - both left and right VR cameras produce the same image:

VR_camera_viewports_look_the_same.png

 

Bug in code

The error seems to happen where the rig cameras are updated in the ancestor class TargetCamera::_updateRigCameras() in https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.targetCamera.ts#L265 . Both left and right cameras have the same position and rotation, thus producing the same image:

284 case Camera.RIG_MODE_VR: 
285 case Camera.RIG_MODE_WEBVR:
286   if (camLeft.rotationQuaternion) {
287     camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);
288     camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);
289   } else {
290     camLeft.rotation.copyFrom(this.rotation);
291     camRight.rotation.copyFrom(this.rotation);
292   }
293   camLeft.position.copyFrom(this.position);
294   camRight.position.copyFrom(this.position);
295
296   break;

I can attempt a pull request to fix this, but I'm not sure if I should just position the 2 cameras apart just like for a stereoscopic camera. Appreciate some comments please, thanks!


Viewing all articles
Browse latest Browse all 760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>