Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    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


    Sep 9, 2014
    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.

    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