Search Unity

CommandBuffer seems to use flipped projection matrix when XR is enabled in Unity 2019.1.0f2

Discussion in 'Image Effects' started by slice3d, May 2, 2019.

  1. slice3d

    slice3d

    Joined:
    May 7, 2011
    Posts:
    207
    VR2019YFlip.png

    CommandBuffer seems to use flipped projection matrix when XR is enabled in Unity 2019.1.0f2

    Reproduction steps:

    1. Create new project in Unity 2019.1.0f2, download this package and import it (Assets > Import Package > Custom Package...).
    2. Open Scene, make sure that XR is enabled in Player settings (Use Mock HMD).
    3. Press Play
    4. See if primitives rendered in Game View match their counterparts rendered by CommandBuffer
    5. Enable 'Fix' toggle on Main Camera's Test component to see how explicitly calling
    commandBuffer.SetProjectionMatrix(GL.GetGPUProjectionMatrix(cam.projectionMatrix, true));
    fixes this issue.
    6. Disable XR in Player settings and repeat steps 3 and 4.
    7. On the contrary, notice how enabling 'Fix' toggle now makes it render improperly.

    Expected behaviour:
    CommandBuffer should always use correct projection matrix no matter if XR is enabled or not.

    I was trying to report this bug via built-in Bug Reporter tool but it also appears to be broken in Unity 2019 ¯\_(ツ)_/¯
    BugInBugReporter.png
     

    Attached Files: