unity-webxr-export icon indicating copy to clipboard operation
unity-webxr-export copied to clipboard

Looking Glass WebXR Support

Open BryanChrisBrown opened this issue 1 year ago • 4 comments

So, this issue is mostly to ask a few questions about the project, specifically around Unity's handling of multiple views as I'm looking to see if it's possible to use this to support the Looking Glass WebXR Library.

It looks like unity currently renders both views to the full framebuffer based on some digging with nvidia nsight,

I've attempted to load the Looking Glass WebXR Library with the Unity WebGL output, and while it does initiate an XR Session it doesn't render beyond two views, this part makes sense because of the way the plugin was written. I'm working on a PR now that remedies this, but was more curious about the full canvas rendering.

The way the Looking Glass WebXR Library works is that it renders a grid of views to the XRWebGLLayer, then runs those through a subpixel shader to render for the Looking Glass display. Currently, the Unity WebGL build seems to render the views to the full framebuffer, rather than the specific quadrant associated with a view, is this something baked into unity, or something that can be configured with how the WebXR Exporter is handled?

Thanks!

BryanChrisBrown avatar Mar 21 '23 21:03 BryanChrisBrown

As Unity is a closed box, the simplest solution was to send the views to the full framebuffer.

I guess you already looked at webxr.jspre. Some pointers that might help, Look where we override bindFramebuffer. And at the start of XRManager.prototype.animate.

Notice that Unity's JS minimizer on some versions supports only ES5, so newer JS syntax won't work in the jspre file.

De-Panther avatar Mar 23 '23 00:03 De-Panther

Any updates? Or things that I can change that would help with this implementation?

De-Panther avatar Apr 15 '23 04:04 De-Panther

I did try building out a basic implementation in unity to test performance. One of the issues that I ran into was unity's webGL / WASM output being limited to a single-thread, rendering 48 cameras at once is much slower than in native builds.

I briefly tried looking into some optimizations for it, but didn't have too much luck and sort of left it at that for the time being.

BryanChrisBrown avatar Apr 23 '23 20:04 BryanChrisBrown

I tried to look if there's open source Looking Glass Unity package, but it seems that I need to download a .unitypackage file... How does the current Looking Glass Unity support works? Number of Cameras? Render Textures? XR SDK?

I recently added support for Unity XR SDK to WebXR Export, but sadly there's no Single Pass or Multiview support for web. I wonder how the current non-web support for Looking Glass handles the rendering of so many views.

De-Panther avatar Dec 26 '23 22:12 De-Panther