Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scriptable Render Loops and VR Rendering

Discussion in 'Graphics Experimental Previews' started by davehun, Jul 26, 2017.

  1. davehun

    davehun

    Joined:
    Jun 27, 2017
    Posts:
    6
    Hi,

    I've been working to create a custom render loop for VR and I'm looking at a single-pass rendering solution, but I can't quite get the instancing to work in ScriptableRenderLoop.

    I've enabled both instancing and the UNITY_SINGLE_PASS_STEREO keyword in my solution. When I invoke ScriptableRenderContext.DrawRenderers, I'm only getting one eye to render correctly.

    Is there something I'm missing?

    Thanks!
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,219
    I'm away from my workstation so I'm shooting in the dark, but have you checked the CBuffers in the Unity Variables shader file? My guess is that for a custom SRP you have to assign those matrices manually.
     
  3. maverikou

    maverikou

    Joined:
    May 25, 2016
    Posts:
    7
    Any updates?
     
  4. davehun

    davehun

    Joined:
    Jun 27, 2017
    Posts:
    6
    I did a bunch of investigation and I'm getting more and more familiar with Unity's single pass VR rendering.

    Here are a few thing I found while working with SRP + VR.

    First thing, I don't think instancing for single pass VR rendering is working yet. I took a capture using renderdoc and found out that DrawIndexedInstanced wasn't being used. That said, in the current state, you'll have to manually render the geometry twice.

    Second thing, for some reason when I try to enable a shader keyword in IRenderPipeline:Render it doesn't get applied to my render objects. I worked around this by enabling the shader keyword at an earlier step outside of the render method.

    I'm currently on 2017.1 and I hope this update helps anyone who is working with SRP.
     
  5. davehun

    davehun

    Joined:
    Jun 27, 2017
    Posts:
    6
    Hey DreamingImLatino,

    I checked the cbuffer matrices and you're right. The stereo matrices aren't being set.

    Thanks.
     
  6. robs_unity

    robs_unity

    Unity Technologies

    Joined:
    Sep 26, 2016
    Posts:
    6
    Hey buds,

    The XR (née VR) SRP APIs will be popping up in 2017.3, which will hopefully be coming out with a beta at the end of the month. This will allow you to use new XR helper APIs that set up the XR state (matrices, viewports, etc). grab a XR eye texture descriptor (to make intermediate targets), and auto-stereo-ize your draws.
     
    Cynicat and Alverik like this.