CXR 4 Unity Plugin - Support for Built-in render pipeline?

Thank you for CloudXR, extremely appreciated!
We are testing the Unity integration right now and discovered that the CXR4 Unity Plugin seems to only support URP as of now. Is there support for BIRP or HDRP planned?

There should be no issue. The rendering is done in sample code, not in the core plugin/SDK code, and while it may take some dev effort, there’s no reason Core RP or HDRP should not work (so long as they work for the platform in question).

1 Like

Thank you @wcannady. You are right, it works this way. We were able to connect from built-in RP although had to change the package’s source code that references URP:

    public void CheckScaling() {
        if (XRSettings.eyeTextureResolutionScale != m_scaleFactor) {
            Log.W($"Someone changed the scale factor! Resetting. {XRSettings.eyeTextureResolutionScale} -> {m_scaleFactor}");
            // CXRUNITY-238
            UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset urPipeline = (UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset) QualitySettings.renderPipeline;
            XRSettings.eyeTextureResolutionScale = m_scaleFactor;
            urPipeline.renderScale = m_scaleFactor;

(in CxrUnityXRManager.cs). For now we’ve commented the respective lines and we can get a connection, also not seeing the log inside the if-statement in the device logs.

We could display the latched frames on a material and saw it behaving correctly, streaming the image from the host PC and updating accordingly with the headset movements. When displayed like that resolution and dimensions seemed fine and sharp. However, to blit it to the screen we’ve tried to implement a postprocess effect and having trouble with the scaling - the textures are scaled massively on the eye (around 10x). Is there anything to be done in the Reprojection Shader when using it with PostProcess or traditional blitting?

The reprojection shader is doing a bit of work to make sure that the server-rendered pixels are laterally reprojected to the right place in Unity’s camera projection. Other than that, no, it’s essentially a blit to screen space.

I’m afraid I haven’t worked with core RP much, and don’t know where to point you to address this texture scaling issue.

1 Like

Thank you @AndreusNvidius , I will investigate further and post new findings. Can we have that line in CxrUnityXRManager.cs removed or expressed in a way that does not make URP a hard requirement in future releases?

Resolution / scale setting is a bit of a mess right now, both in the plugin code and with Unity/XR. The chunk of code you reference is there to ensure that the XR and URP plugins are both set to the same scale factor, which the plugin is changing to ensure that Unity uses a back buffer / swapchain resolution that matches the requested resolution, which is larger than the resolution set by OpenXR’s “recommended” resolution.

We will look into doing this better and with the appropriate guards to ensure it only gets called if URP is included/active.

As a workaround and as mentioned in the post on cxrSendInputEvent, you can extract the plugin contents and edit this file, un-install the package then install the edited package.