Search Unity

Native Rendering Plugin for VR-game, XR-rendering with Scriptable Render Pipeline

Discussion in 'General Graphics' started by SomaRealityGmbH, Feb 26, 2019.

  1. SomaRealityGmbH

    SomaRealityGmbH

    Joined:
    Feb 20, 2019
    Posts:
    3
    Hello guys,

    I’m trying to implement an OpenGL Plugin into a VR-game which should do some external OpenGL rendering written in C++, inside Unity.

    First, I tried the Native Rendering Plugin demo project from https://bitbucket.org/Unity-Technologies/graphicsdemos/overview. But unfortunately, the OpenGL context only renders on the monitor but not inside the VR-headset. My guess is that because the GL.IssuePluginEvent() gets called after WaitForEndOfFrame(), the VR render context is getting updated somewhere before that. (I was also not able to set the OpenGL rendering relative to any game object like it is possible with GL.MultMatrix(), but I would like to have it fixed to somewhere in the game scene instead of an overlay onto the camera)

    Then I came across Scriptable Render Pipelines, where I tried to do the same with the VR Lightweight RP preview. But to me it seems that the XR-Rendering is happening somewhere internally inside LightweightPipeline which I have no access to. LightweightPipeline.JPG

    After that I tried to create my own custom SRP but I am not able to start XR-rendering with BeginXRRenderingPass because it doesn’t recognize ScriptableRenderPass as part of the
    UnityEngine.Experimental.Rendering.LightweightPipeline namespace. Neither in my own project nor the demo project provided by Unity or after downloading the Lightweight package from the package manager.


    Unfortunately, I did not find any guides or tutorials on how to build custom SRPs with XR-rendering. So my question is: Do you know about any guides or resources that I might have missed about SRP XR-rendering and do you think its even possible to implement the OpenGL Plugin into a VR-game using this method or is there a way without using SRPs?

    Thank you in advance
    Michel