ReactVision / viro

ViroReact: The AR and VR library for React Native 📳💙💛🤍💚
MIT License
1.3k stars 150 forks source link

VR using OVR_Mobile has images out of align for each eye #159

Open jerradpatch opened 1 year ago

jerradpatch commented 1 year ago

Requirements:

Please go through this checklist before opening a new issue

Environment

Please provide the following information about your environment:

  1. Development OS: Mac, Windows, Linux: Mac / Oculus Quest 2

  2. Device OS & Version: What Android OS version (7.0, 8.0, etc.) or iOS version (11.0, 11.2) is your device running on? Min 23 sdk

  3. Version: ViroReact version and React Native version:

    "@viro-community/react-viro": "^2.20.2", "react": "17.0.2", "react-native": "0.65.1"

  4. Device(s): What device(s) are you are seeing the issue on (i.e. iPhone X, Samsung Note 8, etc): Oculus Quest 2

Description

Describe your issue in detail. Include screenshots if needed. If this is a regression, let us know.

In the game there are objects and each object is supposed to look like a single / same object for each eye. However, as I get further from the object it is apparent that the camera for each eye has a different vanishing point as the object separate per eye.

After looking through the code of VROSceneRendererOVR::ovrRenderer_RenderFrame and trying to make corrections, I believe the issue is due to the scene being rendered individually per eye. I think the correction needs ether:

1) use the oculus multi-view to render the frame. 2) render the scene for both eyes at the same time using two cameras to create a single vanishing point.

The solution is to add a new function in place of "VRORenderer::renderEye" that takes multiple head views and projections.

For now I have implemented a solution on my fork that makes the eyes a bit cross-eyed to align the vanishing points for each eye, but that only works so well for objects farther away.

Thoughts would be appreceated.

Reproducible Demo

Let us know how to reproduce the issue. Include a code sample, screen capture, video recording. The more information you provide, the better we can support you.

open the 'starter kit', change the platform to OVR_Mobile, modify the AR specific viro components to VR, and (finally) run it on oculus quest 2. From this the double image issue can be seen.

Related to

https://github.com/ViroCommunity/viro/issues/157