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. Dismiss Notice

URP Scriptable Render Feature Blit with Custom Shader not working in VR (Mutliview)

Discussion in 'Universal Render Pipeline' started by DanWeston, Apr 13, 2021.

  1. DanWeston

    DanWeston

    Joined:
    Sep 9, 2014
    Posts:
    32
    I am working in Unity 2019.4.11f1 and have written a Scriptable Render Feature for my project which is using Universal RP 7.3.1.

    The process works completely fine on PC in Editor but has proven troublesome on Oculus Quest 2.

    For VR I am using the Oculus XR Plugin 1.4.3.

    In my post process I am using a Command Buffer to Blit one texture into another using a custom Shader/Material.

    My textures for VR are being set up in a standard way using

    Code (CSharp):
    1. var texID = Shader.PropertyToID("_textureID");
    2. var renderTextureDescriptor = XRSettings.eyeTextureDesc;            
    3. commandBuffer.GetTemporaryRT(texID , renderTextureDescriptor, FilterMode.Bilinear);
    Performing a ping/pong process I am simply doing

    Code (CSharp):
    1. commandBuffer.Blit(ping, pong, customMaterial, 0);
    2. commandBuffer.Blit(pong, ping, customMaterial, 1);
    Using Render Doc and debugging a frame on my Quest I can see my Blit process is not setting any of the textures for the material. The textures are being set to default/white instead. https://imgur.com/a/MHw5Ht9

    I've tried explicitly setting these textures using CommandBuffer.SetGlobalTexture

    Code (CSharp):
    1. commandBuffer.SetGlobalTexture ("_MainTex", ping);
    But nothing seems to work.

    Completely out of ideas on this one, anyone come across this before? I'm not sure what needs to be done to get my textures linked to my Shader.
     
    Last edited: Apr 13, 2021
    krakentanz, daneobyrd and moatdd like this.
  2. krakentanz

    krakentanz

    Joined:
    Aug 13, 2020
    Posts:
    34
    Hey Dan, did you find a solution? I'm getting a gray screen on Quest 2 in Multiview when I'm using (various) blur shaders that utilize Blit materials ...
     
  3. goncalo-vasconcelos

    goncalo-vasconcelos

    Joined:
    May 24, 2017
    Posts:
    8
    Perhaps the information about how to Blit available here might help.