Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question Flickering artifact in rendering with OpenGL ES 3.1 openxr android native plugin

Discussion in 'VR' started by nfynt-zap, Sep 13, 2022.

  1. nfynt-zap

    nfynt-zap

    Joined:
    Jun 3, 2021
    Posts:
    18
    I am trying to write an OpenXR plugin for Unity based on Unity XR-SDK(https://docs.unity3d.com/Manual/xr-sdk.html) targeting android platform with GLES 3.1. So far I've got a basic rendering and 3Dof view tracking in place and working with Monado in-process runtime. I am however getting an odd flickering rendering effect, which seems like a black frame composition in every alternate frame (flickering_video:https://drive.google.com/file/d/1nQrFMo50qrwY8EAKD2u2BKLBkmy542Vg/ and flickering_video_slomo:https://drive.google.com/file/d/1JNEkKb-4ixzhcz1d2kCS2JZLtQ9Z3MUi/).

    Here's my rendering loop with Unity plugin
    Code (CSharp):
    1. xrWaitFrame
    2. xrBeginFrame
    3.  
    4. // for each views (2 here for multi-pass stereo)
    5. xrAcquireSwapchainImage
    6. xrWaitSwapchainImage
    7.  
    8. Unity rendering - multithreaded
    9.  
    10. xrReleaseSwapchainImage x (number of views = 2)
    11.  
    12. xrEndFrame

    Comparing to hello_xr from OpenXR-SDK-source the only difference seems to me is that I am acquiring both the swapchains (left and right views) before starting of rendering and releasing them before calling xrEndFrame. Whereas hello_xr does: acquire->render->release for each views sequentially.

    Any ideas or insights are appreciated.

    Bellow is the test apk if you want to try, please note you'll need android broker and runtime to test the application.
    [Unity apk] https://drive.google.com/file/d/1FPL9jJ15jcdDvXAyhCSM0QESSzeACGYZ/
    [Android broker] https://drive.google.com/file/d/11oCXqanlRv_a73Jjqy-Cv4vK2AenByBl/
    [Android runtime] https://drive.google.com/file/d/1kRxEsRvVVG-EEQRu-sdakWp5wgCc1Is5/
     
    KazantsevPE and Hobodi like this.
  2. KazantsevPE

    KazantsevPE

    Joined:
    Nov 1, 2018
    Posts:
    2
    Good afternoon Were you able to find a solution?