Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Command Buffer Setting Projection Matrix Open XR

Discussion in 'General Graphics' started by xHammy, Jul 4, 2022.

  1. xHammy

    xHammy

    Joined:
    Aug 11, 2017
    Posts:
    27
    Toying with command buffers for the first time, forgive me. The idea is to do an orthographic overlay, pretty much along the lines of Canvas, but under mine own control. Mostly so I can draw it before post processing, draw things beyond what canvas renderers allow, not really important.

    Code (CSharp):
    1. commandBuffer.SetViewMatrix(Matrix4x4.identity);
    2. commandBuffer.SetProjectionMatrix(orthoMatrix);
    Lickety split works as intended. Draws the contents of the command buffer orthographically from world zero. But not in XR. It just draws at my feet normally. Oh yeah, and I'm well aware all documented wisdom adviss against overlay UI in XR. But I have to test the waters with my own toes. Anyway, instead of drawing orthographically in XR, it just draws 3D at world 0.