aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.66k stars 3.97k forks source link

Oculus Go pixel size is too large in VR mode #3942

Closed tlaukkan closed 5 years ago

tlaukkan commented 5 years ago

A-Frame has larger pixels in VR mode than that of native resolution i.e. is the pixels are at least 3-4 times too big.

A-Frame master based scenes and examples at A-Frame site run with too large pixel size in all Oculus Go browsers:

Three.js examples run with correct resolution with Oculus Browser (did not test other browsers.):

This could possibly be some problem with setting the canvas width/height when initializing VR mode. Setting to scene renderer maxCanvasWidth and maxCanvasHeight to -1 does not have effect. Setting antialiasing to true alleviates the problem somewhat but the jagged edges and large pixels are still clearly visible.

I could tweak the display settings in firefox reality to get the content look quite ok when looked in normal browser mode but when entering VR mode the situation remains the same i.e. too large pixel size.

It looks like this was earlier reported but closed after reporter was happy after setting antialiasing=true which does address the root cause of pixel size:

https://github.com/aframevr/aframe/issues/3571

dmarcos commented 5 years ago

I have no Oculus Go to test at the moment. Is there a way to retrieve the canvas size when in VR mode?

tlaukkan commented 5 years ago

I am not sure. I could checkout master, add some debug log output and use firefox reality remote debugging which I hope gives access to console log.

tlaukkan commented 5 years ago

Evaluated in Oculus Go / Oculus Browse console using chrome remote debugging as requested by @dmarcos AFRAME.scenes[0].renderer.getSize();

{width: 2048, height: 1024}

Native resolution of Oculus Go is: 2560 x 1440

This image illustrates how the pixels look in VR mode all though its screen captured in normal browser mode (the pixel size is similar): image

tlaukkan commented 5 years ago

Commenting out of this code did not have effect on the pixel size: https://github.com/aframevr/aframe/blob/master/src/core/scene/a-scene.js#L514-L541

IvoJager commented 5 years ago

@tlaukkan Hi,

Have you tried adding to your a-scene;

renderer="antialias:true"

Adding the above on my Oculus Go helped.

It appears that antialias="true" has been removed and no longer works.

dmarcos commented 5 years ago

Thanks for investigating @IvoJager

dmarcos commented 5 years ago

@tlaukkan Can you confirm if antialias is working for you?

tlaukkan commented 5 years ago

I have that on but it only alleviates the problem as it hides some of the pixelation. However the pixel size is still too large.

arpu commented 5 years ago

looks like aframe should use the meta data like the model-viewer do it ? but no idea why three samples works and aframe not :/

https://github.com/GoogleWebComponents/model-viewer/blob/master/src/utils.js#L114

setting it here https://github.com/aframevr/aframe/blob/master/src/core/scene/a-scene.js#L581

IvoJager commented 5 years ago

I can confirm that, on Oculus Go, turning anti-aliasing off results in much chunkier rendering of the outline of geometry than might reasonably be expected. Yet textures remain smooth. Anti-aliasing turned seems to fix geometry outline issue completely though (as far as I can discern).

I'm not sure if related, but text - regardless of anti-aliasing on/off - turns into a shimmering mess quite quickly at a distance (the same scene and text looks buttery smooth on a WMR headset).

Similarly a forced non-power-of-two texture exhibits the same sort of shimmering that I cannot replicate on other devices/headsets.

I'm not sure if it's the capabilities of the hardware either; I have a Mi5 here with the same SoC and it renders everything just brilliantly w/AFrame.

tlaukkan commented 5 years ago

Anti-aliasing smooths the color difference between adjacent pixels but does not affect he pixel size itself.

IvoJager commented 5 years ago

It's not supposed to, no :) However I think what you and I are seeing in our Oculus Go units, is that without anti-aliasing pixel size seems to be much bigger than AA can account for. Correct me if I'm wrong?

dmarcos commented 5 years ago

Mmhh. Thanks for the patience. Resolution looks good to me (antialias aside) on hello-world and Anime UI on the Oculus Browser. Do you have a link where I can reproduce the problem?

tlaukkan commented 5 years ago

Please compare: https://aframe.io/aframe/examples/boilerplate/hello-world/ https://threejs.org/examples/#webvr_ballshooter

If you observe closely you see that the pixels are larger in aframe. The threejs example has antialias on but I at least do still see the individual pixels and their size when antialias on. That is why you can't now run aframe without antialias on Oculus Go and even with antialias the picture quality varies from mediocre to bad depending on how much high contrast edges you have in the scene.

If you could just take screenshots in oculus browser with in web vr mode. I do not yet have setup for taking photos through the headset lenses.

@dmarcos @ngokevin

tlaukkan commented 5 years ago

It's not supposed to, no :) However I think what you and I are seeing in our Oculus Go units, is that without anti-aliasing pixel size seems to be much bigger than AA can account for. Correct me if I'm wrong?

I think the pixel size does not change with the antialiasing on oculus go. The too large pixels are more obvious when antialiasing is not on.

@IvoJager

arpu commented 5 years ago

@tlaukkan do you find a solution for the wrong resolution size?

arpu commented 5 years ago

@ngokevin why is this closed?

i get {x: 600, y: 450}


isvr-scene.js?bc25:16 enter-vr component
(anonymous) @ isvr-scene.js?bc25:16
emit @ aframe-master.js?b048:21904
enterVRSuccess @ aframe-master.js?b048:23324
Promise.then (async)
enterVR @ aframe-master.js?b048:23312
onEnterVRButtonClick @ aframe-master.js?b048:17892
bound @ aframe-master.js?b048:27452
(anonymous) @ aframe-master.js?b048:17982
aframe-master.js?b048:52851 WebGLRenderer: .getsize() now requires a Vector2 as an argument
WebGLRenderer.getSize @ aframe-master.js?b048:52851
(anonymous) @ isvr-scene.js?bc25:19
emit @ aframe-master.js?b048:21904
enterVRSuccess @ aframe-master.js?b048:23324
Promise.then (async)
enterVR @ aframe-master.js?b048:23312
onEnterVRButtonClick @ aframe-master.js?b048:17892
bound @ aframe-master.js?b048:27452
(anonymous) @ aframe-master.js?b048:17982
isvr-scene.js?bc25:19 Vector2 {x: 600, y: 450}```
arpu commented 5 years ago

looks like the canvas size should set from VRDisplay https://developer.oculus.com/documentation/oculus-browser/latest/concepts/browser-webvr-api/

   vrDisplay = displays[0];

      // We must adjust the canvas (our VRLayer source) to match the VRDisplay
      var leftEye = vrDisplay.getEyeParameters("left");
      var rightEye = vrDisplay.getEyeParameters("right");

      // update canvas width and height based on the eye parameters.
      // For simplicity we will render each eye at the same resolution
      layerSource.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
      layerSource.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);
dmarcos commented 5 years ago

I don’t have any issues on Go. How does the problem manifest? There’s nothing special in the VR path of the Go with respect to other devices and browsers

arpu commented 5 years ago

for me it loos like the resolution looks not that nice as should be

arpu commented 5 years ago

have done more debugging on this the render for vr is set in the WebVrManager THREEonVRDisplayPresentChange isPresenting:1024 1024 -> the renderer on the oculus go is 2*1024 x 1024

why is it not 2560x1440 ? like the display size is?