Search Unity

Alter stereo projection matrices in URP 12.1

Discussion in 'Universal Render Pipeline' started by cdibbs, Apr 30, 2022.

  1. cdibbs

    cdibbs

    Joined:
    May 3, 2019
    Posts:
    17
    I am having great difficulty determining what is the correct way to jitter the stereo projection matrices in URP 12.1. Historically and without stereo it looks like you could add a RenderPass to do this BeforeRenderingOpaques:

    Code (CSharp):
    1.         public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    2.         {
    3.             CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag);
    4.             using (new ProfilingScope(cmd, m_ProfilingSampler))
    5.             {
    6.                 CameraData cameraData = renderingData.cameraData;
    7.                 cmd.SetViewProjectionMatrices(cameraData.camera.worldToCameraMatrix, m_TaaData.IProjOverride);
    8.  
    9.                 context.ExecuteCommandBuffer(cmd);
    10.                 cmd.Clear();
    11.             }
    12.             context.ExecuteCommandBuffer(cmd);
    13.             CommandBufferPool.Release(cmd);
    14.         }
    15.  
    I've also seen strategies around:

    Code (CSharp):
    1. RenderPipelineManager.beginFrameRendering += RenderPipelineManager_beginFrameRendering;
    But nothing seems to work. Could anyone point me in the right direction on this? Thanks!
     
  2. cdibbs

    cdibbs

    Joined:
    May 3, 2019
    Posts:
    17
    Bump. Found this in ScriptableRenderer.cs. The code and comments seem to contradict each other.

    upload_2022-5-1_19-4-44.png

    Do I need to make a modified copy of URP just to be able to jitter the camera matrix in the SRP? Are there any alternatives?
     
    timmehhhhhhh likes this.