Closed FeldNico closed 4 years ago
I have the same issue on my Quest and my oculus GO. The issue appears when I click on the VR button inside the app. I get a black screen with an infinite loading
I use Unity 2019.2.20 and your scene example
If this is deploy in a non secure context (HTTPS or localhost) WebXR is not supported and therefore the polyfill kicks in. But if we are delpoying this on a HTTPS server (tested with Oculus Quest and Android Chrome) the user does not get ask for permission to start a VR-Session and we are stuck in an infinite loop. https://github.com/De-Panther/unity-webxr-export/issues/9
Maybe requesting a VR-Session before starting the game could be a work around. I will test this.
Solved the issue there. It was a combination of not rendering to the XRWebGLLayer. Calling bindFramebuffer with the XRWebGLLayer framebuffer solved the infinite loading circle issue.
And then I had an issue with the view - it was rendered in the bottom left corner of the left eye. Setting the canvas size based on the XRWebGLLayer size when session starts solved this. Adding event listener to window resize won't do the trick here, as the window size stays the same.
The fork I opened is based on the old WebVR export, so it'll be lots of work to merge them now.
This comment is just a hint on how to solve this issue.
Hi! indeed one of the issues is that there was that this.xrDisplay.submitFrame();
left from the WebVR implementation :)
I believe another problem could be regarding the windows.rAF call, as that was running previously even if you are inside VR when using the previous WebVR API, but on WebXR the window.rAF is disabled when entering VR, so probably that freezes the Unity execution.
I'll try to take a look at the code to see if it's something easy to fix or not as I was not involved on the conversion to WebXR.
@De-Panther thanks for the hints, I'll try to look into these too! :)
You can look at https://github.com/De-Panther/unity-webxr-export/blob/db59bd699a27d5663ecc25aa5bcfad3e08eb3c55/Assets/WebGLTemplates/WebXR/webxr.js
I cache Unity's rAF callback/render function for when switching from window.rAF to xrSession.rAF. In Polyfill mode, need to re-call the window.rAF when exiting VR, and in WebXR mode need to call xrSession.rAF when entering VR.
@De-Panther thanks a lot, I was digging into the code and I included many pieces on it, still there are few things I would like to dig. The exit VR on the emulator doesn't work as expected eg I'll try to play around these in the incoming weeks. I created a PR with the changes. I tried it on Unity 2019.3.4f1 and it works as expected on the Quest.
@FeldNico @JoRangers @De-Panther it should be working now, please give it a try at https://mixedreality.mozilla.org/unity-webxr-export
Thanks for the credit. Great progress. I checked the new demo and it works as intended.
Is this repository going to be maintained regularly? As I have more improvements that I want to do on my repository (e.g. remove calls for SendMessage as it's very heavy and happens each frame. can use C headers and pointers for C# methods instead), and wonder if I should keep about those fixes and updates in this repository.
@De-Panther we would like to keep it updated so it would be great if you decide to contribute too I can add you as a collaborator if you are willing to or just submit the PR you consider interesting for the project ^_^ I know that the 2020 Webgl template is going to work also a lot, so that's another point I'd like to dig into. So yeah, any help is more than welcome! ;)
Those are good news. Is there a place to talk about future updates for this repo? (not a single suggestion or a feature request) I have some directions in which I wanted to take my repo, but if they are all aligned, there's might no need to work on two different ones.
When I try the example on my Oculus Quest (Firmware 14) I get stuck in an infinite loading screen. Connecting the Chrome-Debugger reveals that the gameloop is running, but it seems that the frame is not rendered properly.
One issue I found is that on line 319 in webxr.js
this.xrDisplay.submitFrame();
xrDisplay cannot be found (maybe a relic from webvr?)Thank you for your help!