Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Y position incorrect in some cases while in VR #2448

Closed
machenmusik opened this issue Mar 2, 2017 · 22 comments
Closed

Camera Y position incorrect in some cases while in VR #2448

machenmusik opened this issue Mar 2, 2017 · 22 comments

Comments

@machenmusik
Copy link
Contributor

mchen [12:59 PM]
interesting default camera Y height behavior with current master...
http://codepen.io/machenmusik/pen/JWXGap

With Rift and latest Chromium, when using the auto-enter/exit VR, user height is correct both outside VR (default user height 1.6) and in VR (true HMD height), first time and every time. That consistency is provided by #2428.

With Rift and latest Chromium, when manually clicking the enter VR button but not wearing the HMD, user height is correct outside VR (default user height 1.6) but wrong inside VR (e,g, camera placed higher than true HMD height once you put it on).

With Rift and latest Nightly, it appears that vrdisplayactivate is not working and therefore neither is auto-enter VR (i.e. you put on the Rift, see nothing, and still have to click the button).

With Rift and latest Nightly, when manually clicking the enter VR button but not wearing the HMD, user height is always 1.6 since it just goes fullscreen and doesn't try to enter VR at all. In fact, it won't try to enter VR at all unless you reload the page.

With Rift and latest Nightly, when manually clicking the enter VR button while wearing the HMD, user height is correct outside VR (default user height 1.6) but wrong inside VR (e,g, camera placed lower than true HMD height once you put it on, apparently by 1.6 the default user height), first time and every time. That consistency is provided by #2428.

So two apparent bugs:
(1) Nightly vrdisplayactivate is not working.
(2) Manually entering VR via UI button seems to have some issue with getting initial HMD position/height, and since applied as deltas by look-controls, that stays wrong while in VR.

@machenmusik
Copy link
Contributor Author

using http://chenz.org/vr-camera-height.html to avoid any potential issues with codepen,
same behavior above is seen.

@machenmusik
Copy link
Contributor Author

machenmusik commented Mar 3, 2017

With Rift,

if you place a breakpoint at src/components/look-controls.js line 214
and then evaluate some variables in console,

Nightly, which does NOT work properly, does NOT return stageParameters:

this.dolly.position
Object { x: 0.2644968032836914, y: -0.8083080649375916, z: -0.9467211961746216 }
this.controls.getVRDisplay()
VRDisplay { isConnected: true, isPresenting: true, capabilities: VRDisplayCapabilities, stageParameters: null, displayId: 1, displayName: "Oculus VR HMD", depthNear: 0.005, depthFar: 10000 }

Chromium, which works properly, does provide stageParameters:

this.dolly.position
Vector3 {x: 0.009547733701765537, y: 0.5052434802055359, z: 0.014989607967436314}
this.controls.getVRDisplay().stageParameters
VRStageParameters {sittingToStandingTransform: Float32Array[16], sizeX: 2.0250000953674316, sizeZ: 2.0250000953674316}

@machenmusik
Copy link
Contributor Author

machenmusik commented Mar 3, 2017

With Vive,

if you place a breakpoint at src/components/look-controls.js line 214
and then evaluate some variables in console,

Nightly works properly, and stageParameters are returned:

this.dolly.position
Object { x: 0, y: 0.75, z: 0 }
this.controls.getVRDisplay().stageParameters
VRStageParameters { sittingToStandingTransform: [16], sizeX: 1, sizeZ: 1 }

Chromium, which also works properly, does provide stageParameters:

this.dolly.position
Vector3 {x: -1.1390511989593506, y: 0.31331753730773926, z: -0.6187263131141663}
this.controls.getVRDisplay().stageParameters
VRStageParameters {sittingToStandingTransform: Float32Array[16], sizeX: 0, sizeZ: 0}

@machenmusik
Copy link
Contributor Author

So it appears that the camera height issue is result of a bug in Oculus Rift support in Nightly where the stageParameters are not returned on the VRDisplay, and so the code cannot correctly adjust for roomscale.

Who from Mozilla can confirm and address? @kearwood? @cvan?

@kearwood
Copy link

kearwood commented Mar 3, 2017

Thanks for spotting the missing stageParameters for Oculus. Oculus wasn't capable of roomscale when we first implemented support. Since then, we have updated to the newer Oculus SDK with support for the Oculus Guardian system and will be adding stageParameters for Oculus:

https://bugzilla.mozilla.org/show_bug.cgi?id=1344393

You can expect this to be implemented early next week.

@machenmusik
Copy link
Contributor Author

Great, thanks @kearwood! While modernizing, it would be great to expose capacitive events for Oculus Touch, but that is probably a little more work.

@machenmusik
Copy link
Contributor Author

sorry I haven't had time yet - anyone had a chance to test latest Nightly with Rift for stageParameters?

@machenmusik
Copy link
Contributor Author

latest Nightly exhibits same behavior @kearwood

@machenmusik
Copy link
Contributor Author

Running latest Nightly, I now see that Rift HMD height is correct, but the Touch controllers are still in the floor the way the HMD used to be :-/ @kearwood thoughts?

@machenmusik
Copy link
Contributor Author

Codepen for the Y height issue which appears to now impact Touch controller, not HMD...
http://codepen.io/machenmusik/pen/aJNejw
@dmarcos @ngokevin @kearwood let me know if you would prefer to close this issue and open a new one on the controller.

@cvan
Copy link
Contributor

cvan commented Mar 20, 2017

@caseyyee ping here for your experiences

@machenmusik
Copy link
Contributor Author

(@fernandojsg do you see this with your recent A-Blast Touch changes?)

@caseyyee
Copy link
Contributor

I would think it's something like the room transform not being applied to the controller pose? ie:

https://github.com/mrdoob/three.js/blob/dev/examples/js/controls/VRControls.js#L127

@machenmusik
Copy link
Contributor Author

(not sure why that should differ across browsers though?)

@machenmusik
Copy link
Contributor Author

machenmusik commented Mar 20, 2017

@machenmusik
Copy link
Contributor Author

patch for applying user height when null stageParameters in #2446 but should probably test with daydream controller to make sute it doesn't break 3DoF

@caseyyee
Copy link
Contributor

caseyyee commented Mar 21, 2017

@machenmusik can we break that commit into a separate PR? I think the emulation pieces need to be discussed in more detail before we can commit to those changes.

I will give it a spin on daydream and report

Hugely appreciate the patches!

@machenmusik
Copy link
Contributor Author

i think that commit may be separable, but you can try it on daydream now using chenzlabs master via rawgit (which I think I have codepen for...)

@caseyyee
Copy link
Contributor

caseyyee commented Mar 21, 2017

Horray! I just cherry picked the commit 53d72ca and it seems to resolve the issue with the rift and also works with daydream as well.

@machenmusik
Copy link
Contributor Author

ok great! i am tied up for some time, if you want to do a PR with just that cherry pick feel free - but I do think we should commit the rest of the changes needed to fully leverage recent Nightly support for Oculus Touch ASAP, or else the controllers still won't be entirely usable

@caseyyee
Copy link
Contributor

@machenmusik gotcha. Will take a look at the rest of the PR.

@machenmusik
Copy link
Contributor Author

I got a few minutes to submit #2510

machenmusik added a commit to chenzlabs/aframe that referenced this issue Mar 22, 2017
* also apply userHeight to controller when no stage parameters (fixes aframevr#2448) (aframevr#2510)

* to fix Nightly issue with null stageParameters,
add camera userHeight if null stageParameters;
to keep tests working, only getVRDisplays when VR entered.

(NOTE: tried to move getVRDisplays from system into component where dolly is,
but got weird effect where right hand was applying offset but right hand wasn't,
so there may still be some strange race condition somewhere)

* minor edits per discussion on PR

* Bump aframe-master dist/ builds. (aframevr/aframe@cd12166...3178d75)

* Update master CDN URL. (https://rawgit.com/aframevr/aframe/74884e4/dist/aframe-master.min.js)

* add axes mapping, axismove handler and emulated property, as well as tests

* add emulated property to docs

* accommodate temporary Nightly issue where Touch is supported but has lowercased handedness in id string

* Pass along changed event with button state, using the buttom mapping for convenience.

* pass along axis changed flags from tracked-controls, and check them in oculus-touch-controls and vive-controls to avoid spurious axis moved events

* add update comment per discussion on PR

* fix typo

* for compatibility, if no changed array for axismove event, treat as changed

* map to forEach, per discussion on PR

* remove emulated property per discussion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants