CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.86k stars 3.47k forks source link

VR mode image splitting #8137

Open SorryNotSorryBasileus opened 5 years ago

SorryNotSorryBasileus commented 5 years ago

useWebVR property os scene splits image into two. However, I found that it does not look properly in VR headset (testing in HTC Vive). Basically, in VR you expect to see two different images that propelry align in headset, but in Cesium this images almost identical which creates effect of double vision (diplopia). I found #3909 which was supposed to be fixed in #5917, but setting eyeSeparation works only at specific distance (like it doesn't make sense to be different depending at distance to object), and focalLength doesn't help at all. So after looking through source code, I think that problem is at executeWebVRCommands function in Scene.js. If instead of setting offset to viewing frustum, set PerspectiveOffCenterFrustum with planes calculated according to referenced in code paper, images align correctly.

lilleyse commented 5 years ago

@SorryNotSorryBasileus thank you for looking into this. Would you be able to open a pull request with this fix?

SorryNotSorryBasileus commented 5 years ago

@lilleyse I will need to look into contributor's guide first.) But yeah, sure.