Jump to content

[SOLVED] - VR Cameras Overlap Each Other


MackeyK24
 Share

Recommended Posts

When using VR device orientation free camera ... My two eye cameras OVERLAP in the center... On all other mobile apps i am testing out there is CLEARLY a separation of the eye cameras ... A little BLACK space in between cameras... I thought set the VRCamersMetrics.lensSeperationDistance would allow me to change that... BUT it does not seems to do anything.... My VR cameras look like this:

Screen Shot 2017-01-16 at 12.34.54 AM.png

 

Any clues on how to move the camera apart so there is a little black space in between ???

 

Link to comment
Share on other sites

Hi Mackey!  http://www.babylonjs-playground.com/#1JSXHW#18

I believe that playground will give you everything you need.  See the default camera metrics dumped to console.  Adjust lines 24, and 32-33, and I think you're rolling.  And don't forget the retrieval in line 19 and the write-back in line 29.  These "metrics" values are interesting. 

I believe the vr device itself... has metrics too... and might be a different version than BJS/standard metrics.   Perhaps the device has some of its own "extras". 

Teach us what you learn, when you get a chance, if possible.  (thx)  :)

In lines 32-33, remember that viewport positions are like texture positions... with 0,0 in the bottom left.  Hope this helps.  Party on!

Link to comment
Share on other sites

I have answered this before, I think.  It has to do with the viewports of the sub-cameras.  They each have a width of .5.  One has a left of 0 & the other .5.  Try searching for me, viewport, and sub-camera, maybe.  I am not sure what problem you are trying to solve.  I do not have hardware to running this. 

May get MS Hololens once $3k drops & supported.  It does not look like it is going to be implemented this way BJS.

Link to comment
Share on other sites

17 hours ago, JCPalmer said:

I have answered this before, I think.  It has to do with the viewports of the sub-cameras.  They each have a width of .5.  One has a left of 0 & the other .5.  Try searching for me, viewport, and sub-camera, maybe.  I am not sure what problem you are trying to solve.  I do not have hardware to running this. 

May get MS Hololens once $3k drops & supported.  It does not look like it is going to be implemented this way BJS.

 I am looking at PR the VRCameraMetrics.GetDefault and adding a VRCamerMetrics.SetDefault... Also adding support to VRCamerMetrics to hold the default viewports as well... Then at the start of app just new vr camera defaults with BABYLON.VRCameraMetrics.SetDefault(metrics);

Hopefully the powers that be that run babylon js will like that approach and allow the PR :)

 

Link to comment
Share on other sites

@JCPalmer Yep, you are the one that helped me code that playground, Jeff.  You are the one that taught me and @ozRocker how to set nose-bridge gap.  :)  Combination of viewports and metrics.  You rock!

@MackeyK24, aren't the defaults already set, by default?  I think... once a "metrics-based" camera is chosen, the metrics are applied IF... um... browser says that a webVR cam is present.  Then, when "rig mode" is chosen, it applies a viewport config.

I don't know much about webVR vs. other kinds of VR.  But... if I remember right, webVR has a browser involvement.  The browser CAN, or NEEDS-TO report that a webVR cam is connected.

I dunno, I'm just talking out my butt, I think.  :)  I'm not sure .SetDefault(myMetricsAndViewportRig) is wise or necessary.  (and Wingy, nobody asked YOU what you thought about ANY of this, so stfu, Wingle Dingle)  :D

Link to comment
Share on other sites

2 minutes ago, Wingnut said:

@JCPalmer Yep, you are the one helped me code that playground, Jeff.  You are the one that taught me and @ozRocker how to set nose-bridge gap.  :)  Combination of viewports and metrics.  You rock!

@MackeyK24, aren't the defaults already set, by default?  I think... once a "metrics-based" camera is chosen, the metrics are applied IF... um... browser says that a webVR cam is present.  Then, when "rig mode" is chosen, it applies a viewport config.

I don't know much about webVR vs. other kinds of VR.  But... if I remember right, webVR has a browser involvement.  The browser CAN, or NEEDS-TO report that a webVR cam is connected.

I dunno, I'm just talking out my butt, I think.  :)  I'm not sure .SetDefault(myMetricsAndViewportRig) is wise or necessary.  (and Wingy, nobody asked YOU what you thought about ANY of this, so stfu, Wingy)  :D

 This

export class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {

        constructor(name: string, position: Vector3, scene: Scene, compensateDistortion = true, vrCameraMetrics: VRCameraMetrics = VRCameraMetrics.GetDefault()) {
            super(name, position, scene);

            vrCameraMetrics.compensateDistortion = compensateDistortion;
            this.setCameraRigMode(Camera.RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });
        }


        public getClassName(): string {
            return "VRDeviceOrientationFreeCamera";
        }
    }

is the VR Device Camera:

 

You have to pass the metrics to the camera constructor, if not is will use the value return by GetDefault... Now if you are NOT manually contracting the camera object.. you have NO way to pass the metrics value to the camera ... so it will use the GetDefault... But you still need to set or change a value of the VRCameraMetrics properties... the static SetDefault will allow use to set that is the vr camera default before hand... so when camera gets deserialized and calls VRCameraMetrics.GetDefault ... it will use our default values (plan to include viewports in the GetDefault as well)... 

 

Then one clean swoop our VR camera will work with our custom settings and viewport and NOT have to back and RE-RIG that camera with code like this:

 

var metrics = BABYLON.VRCameraMetrics.GetDefault();

	dumpit(metrics);

	// set separation distance of the two scene VIEWS. No nose-bridge adjust here. 
	metrics.lensSeparationDistance = 0.07; // dflt is 0.063500002
	// metrics.interpupillaryDistance = .01; // dflt is 0.064000003
	// metrics.interaxialDistance = 1; // dflt is 0.064000003

	// apply the metrics
	camera.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: metrics, interpupillaryDistance: 0.01, interaxialDistance: 0.01 });

	// widen the nose-bridge
	camera._rigCameras[0].viewport = new BABYLON.Viewport(0, 0, 0.45, 1.0);
	camera._rigCameras[1].viewport = new BABYLON.Viewport(0.55, 0, 0.45, 1.0);

 

No offense... is good code.. gets the job done... But gain everything i do is for the toolkit... I would not want this kinda code as the BASIS for everyone application using the toolkit... See what i saying... if this is going into a toolkit that we all want to make games using... These kinda parts should be optimized as much as possible... I HATE having to go back and re-rig something that can be more efficient set during deserialization and or construction

I hope i am making sense to you all :)

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...