Using the Universal Render Pipeline

How to use ARRenderingManager with the Universal Render Pipeline.

Overview

In order to use the ARRenderingManager with URP, make sure all the below conditions are met.

  • Your project is enabled to use the URP.

    • This can be done automatically by creating a new Unity project using the Universal Render Pipeline template. If you don’t see an option to use this template, click the down arrow next to the New button and make sure the version of Unity selected is 2019.4 or newer.

    • Or, manually enable your project by opening the Package Manager (menu: Window> Package Manager) and installing the Universal RP package.

  • A pipeline asset is assigned to the Graphics menu’s Scriptable Render Pipeline Settings field (menu: Edit> Project Settings> Graphics).

  • The following features are added to your pipeline’s default renderer:

    • The ARSessionFeature in order to get AR frame updates.

    • The DepthMeshRendererFeature in order to use depth-based mesh occlusion.

    • Note: The provided ArdkUrpAssetRenderer contains both these features, and can be used to start off. The provided ArdkUrpAsset pipeline asset uses this renderer.

  • In order to use Virtual Studio’s mock semantic segmentation feature, the ArdkReplacementRenderer must also be added to your pipeline asset.

ARSessionFeature

The ARSessionFeature is designed to work as similarly to a non-URP pipeline as possible, and enqueues two passes to the renderer, each executing a single command buffer for a single camera.

  1. The first is for rendering the camera feed, added to the RenderPassEvent.BeforeRenderingOpaques stage. This buffer can be set with the ARSessionBuffersHelper.AddBackgroundBuffer(camera, commandBuffer) method.

  2. The second is for triggering and surfacing AR updates, added to the RenderPassEvent.AfterRendering stage. This buffer can be set with the ARSessionBuffersHelper.AddAfterRenderingBuffer(camera, commandBuffer) method.

The ARSession constructor handles initialization for the after rendering pass for Android and ARCore. Each enabled ARFrameRenderer handles initialization for the background pass. Both those classes explicitly use the ARSessionFeature; however, using custom command buffers with your own custom renderer features is also possible.

See Also

For more information on how ARDK’s render pipeline runs under the hood: