Rufus31415 / Simple-WebXR-Unity

⭐ Bringing WebXR to Unity 3D ! B-)
https://rufus31415.github.io/webxr/MRTK-HandInteraction/
MIT License
573 stars 82 forks source link

This is forcing resolution really low for some reason #57

Closed stephen-t-dodds closed 1 year ago

stephen-t-dodds commented 1 year ago

Without this package, my build loads webgl in mobile and desktop browser at the same resolution as the assets are set to in unity. For example, a picture at 1080p is 1080p on mobile and desktop. Once this package is attached to my project, the same build with no additional changes will visually look like maybe 720p on desktop and like 140p on mobile browser. Is this forced somewhere in a script? I know it is not my webgl template because I use the same one, the only difference is adding this package? Can I remove this forced reduction manually without breaking anything? Thanks.

Rufus31415 commented 1 year ago

Did you locate in the SimpleWebXR code the code that changes the resolution?

stephen-t-dodds commented 1 year ago

No, I saw that the jslib references resolution a few times, but it is hard to tell where it is actually getting its values from. At: InternalStartSession: function () the canvas is reset to some new values: _canvasWidth = GLctx.canvas.width;

This looks like the most likely culprit. Do you know where GLctx.canvas gets its values from?

Rufus31415 commented 1 year ago

OK, there is indeed a change in resolution when the WebXR immersive session is started:

https://github.com/Rufus31415/Simple-WebXR-Unity/blob/492fa0893c2b41a7a39207cbc96a76707fa823c6/com.rufus31415.simplewebxr/Runtime/Plugins/WebGL/SimpleWebXR.jslib#L382

This is necessary to make an image suitable for the full screen XR system.

Is the problem that when you leave the immersive session, the resolution remains the same as during the session and does not return to the starting resolution?

stephen-t-dodds commented 1 year ago

The problem is that the resolution during the session is just too low to be usable for my situation. The drop in resolution is just too much.

stephen-t-dodds commented 1 year ago

I just re-tested an old build today that looks like decent resolution, so I need to go back and figure out if I did something weird in-between those builds.