De-Panther / unity-webxr-export

Develop and export WebXR experiences using Unity WebGL
https://de-panther.github.io/unity-webxr-export/
Apache License 2.0
1.04k stars 108 forks source link

Oculus Quest Browser - Stuck at loading #9

Closed FeldNico closed 4 years ago

FeldNico commented 4 years ago

When I try this with my Oculus Quest I get an indefinitely loading screen after clicking on the VR-Button. There's no error message in the console and setting breakpoints etc. works. Therefore it is running, only the rendering does not work.

You have any idea?

Unity 2019.3.6f1 Oculus Quest Firmware 14

Edit: Forgot to thank you for this project!

De-Panther commented 4 years ago

I'll try to check it in the next few days.

Is it your own build that get stuck or the one here https://de-panther.github.io/unity-webxr-export/ Are you running it using the Oculus Link or using the Quest browser?

Thanks for the feedback

FeldNico commented 4 years ago

I used both my own build and the one you provided. Same result :/ I am using the Oculus browser from the quest. Mozilla started integrating WebXR themself on their repo, but the same issue there...

De-Panther commented 4 years ago

Tested it now. It seems that in some cases(for now, HTTPS URLs) it waits for permissions and then get stuck in this black fullscreen with loading circle. So need to handle it when calling navigator.xr.requestSession

De-Panther commented 4 years ago

Also might be related to not using inline session.

De-Panther commented 4 years ago

There were a few issues: The game loop stopped when switching to VR mode.

When restarting the game loop, there's rendering issue.

On HTTP URLs and devices that doesn't support WebXR the exporter uses polyfill, so it worked on HTTP as it used the WebVR APIs, but there are some differences behind the scenes between how the WebXR Polyfill API works and the actual WebXR API works. So needs to add some fixes around that.

De-Panther commented 4 years ago

I'll work on it this weekend, but if you or anyone else needs more info: It's a rendering issue, not permissions. In my tests last week, I succeeded in rendering the view in the lower left side of the headset left eye. Had to add to XRManager.prototype.animate

let glLayer = this.xrSession.renderState.baseLayer;
this.ctx.bindFramebuffer(this.ctx.FRAMEBUFFER, glLayer.framebuffer);
this.ctx.clear(this.ctx.COLOR_BUFFER_BIT | this.ctx.DEPTH_BUFFER_BIT);

The next stage would be to get each Unity Camera view, and render it to the correct viewport.

You can see how it's done in https://github.com/immersive-web/webxr-samples/blob/master/immersive-vr-session.html

So it's a matter of catching the line where Unity tells the WebGL to draw each camera.