-
Notifications
You must be signed in to change notification settings - Fork 126
fix issues with {getFrameData,submitFrame} must be called within a VRDisplay.requestAnimationFrame callback.
(fixes issue #65); fix JS errors Screen position out of view frustum
in Chrome Canary (fixes issue #64)
#132
fix issues with {getFrameData,submitFrame} must be called within a VRDisplay.requestAnimationFrame callback.
(fixes issue #65); fix JS errors Screen position out of view frustum
in Chrome Canary (fixes issue #64)
#132
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cvan Tested with FF and Chrome Canary, looks to be working well. The only thing that broke is that we're starting out in the ground.
Looks like were not hitting the stageParameters bits:
https://github.com/mozilla/unity-webvr-export/blob/master/Assets/WebGLTemplates/WebVR/webvr.js#L123-L124
thanks for testing. any ideas how to fix? did you check + build on |
Build/index.html
Outdated
@@ -3,8 +3,8 @@ | |||
<head> | |||
<meta charset="utf-8"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |||
<title>Unity-WebVR-Export</title> | |||
<meta name="description" content="Unity-WebVR-Export"> | |||
<title> | Unity-WebVR-Export</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this hasn't been updated on master
when y'all have built the project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too. I don't understand why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have issue #116 filed. (I just upgraded to the .3
version of Unity; mayve that'll change things. I'll let you know.) thanks!
Assets/WebGLTemplates/WebVR/webvr.js
Outdated
function onUnityLoaded() { | ||
|
||
function onUnityLoaded () { | ||
// Get and hide Unity's `<canvas>` instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get the comment. What you are hiding is the loader, not the <canvas>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this got moved in some merge/stash-patch applied. will remove.
Assets/WebGLTemplates/WebVR/webvr.js
Outdated
console.log('vr exit present success!') | ||
function onExitPresent () { | ||
if (!vrDisplay && !vrDisplay.isPresenting) { | ||
throw new Error('No VR display to exit VR mode'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use a console.warn()
here and fail silently but it's your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the VRManager
, I've got in a local branch (initially started for this, and then for #104, and so on), I have turned these functions into methods, and this places nicely with it.
I'm cool with removing that for now. thanks for mentioning the inconsistency; it was bothering me too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw you replaced a different throw
with a warning but what about this exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I missed this one. got distracted with the launch logistics today. will resivit this on Tuesday. (I’m PTO tomorrow, and Monday is a US holiday.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. I'll do.
Assets/WebGLTemplates/WebVR/webvr.js
Outdated
// `vrDisplay.submitFrame(…)`. So for the first frame that this is called, we will | ||
// abort early and request a new frame from the VR display instead. | ||
if (vrDisplay.isPresenting && !submitNextFrame) { | ||
submitNextFrame = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the conditional is true
, then submitNextFrame
is already false
. What's the point of this assignment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doy, that's what I get for working late. I should be checking only !submitNextFrame
. thanks.
and that order does matter; I don't know if the comment above makes sense. anything I clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like the flag, if true, ensures that we are inside a vrDisplay.requestAnimationFrame
. Anyway, it was clear enough for me. Perhaps we can think of a better fix when addressing #104
window.requestAnimationFrame(onAnimate); | ||
function onAnimate () { | ||
if (!vrDisplay || !vrDisplay.isPresenting) { | ||
windowRaf(onAnimate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a kind of active polling, so you repeat the check on vrDisplay
. I would prefer this to be event-driven but if that's not possible, can you clarify why you are rescheduling onAnimate
in a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could actually remove these lines, good call. they were leftovers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are leftovers, please, do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven’t step-debugged the rAF calls. but I think if I add a debugger
call to the monkeypatched window.requestAnimationFrame
function, I can see how often and when Unity’ s WebGL Engine makes the calls. I want to minimise the rAF calls as much as possible. in my testing today, I removed this block and didn’t notice any degradation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking. Let's move to #104
Build/manifest.webmanifest
Outdated
@@ -22,7 +22,7 @@ | |||
], | |||
"screenshots": [ | |||
{ | |||
"src": "https://raw.githubusercontent.com/caseyyee/unity-webvr-export/master/img/preview.gif", | |||
"src": "https://raw.githubusercontent.com/mozilla/unity-webvr-export/master/img/preview.gif", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delapuente: how come these changes weren't changed when you did the builds manually yourself? do we have something wonky set up here?
I'd be curious to get on Vidyo together, the three of us, and compare our Unity flows. I'm sure there are some interesting workflows and edge cases we're handling differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to do it. Send an invitation if you want.
I pulled, rebased, but I'm still getting these conflicts according to GitHub. hmm… I'll have to look in the morning (my morning). |
@delapuente @caseyyee: ignoring the thanks for reviewing and testing, you both 👍 |
No problem Chris, if you can not solve the issues, I will rebase it. I'm having problems with my VIVE right now and cannot wake the base stations up so I can not test it. Go to sleep. ZzzZzz |
This is inevitable:
Now, when not presenting, we are not updating the camera matrices (which is mandatory because |
@delapuente with the polyfill, it should still update (this should be the old version still?) If we replaced it with the newer one, then yeah. It won't hit that code path. |
Even with the polyfill, the execution will never hit that code path (notice the test condition and the early return) |
@cvan, I've discarded your changes on |
Fix #64
Fix #65
seems to work well. feedback to approach, including possible edge cases I've missed, welcome.
tested with HTC VIVE on Windows 10 in both Chrome Canary and Firefox Nightly.