Using the Universal Render Pipeline
How to use
ARRenderingManager with the Universal Render Pipeline.
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 (URP) 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:
ARSessionFeaturein order to get AR frame updates.
DepthMeshRendererFeaturein order to use depth-based mesh occlusion.
Note: The provided
ArdkUrpAssetRenderercontains both these features, and can be used to start off. The provided
ArdkUrpAssetpipeline asset uses this renderer.
In order to use Virtual Studio’s mock semantic segmentation feature, the
ArdkReplacementRenderermust also be added to your pipeline asset.
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.
The first is for rendering the camera feed, added to the
RenderPassEvent.BeforeRenderingOpaquesstage. This buffer can be set with the ARSessionBuffersHelper.AddBackgroundBuffer(camera, commandBuffer) method.
The second is for triggering and surfacing AR updates, added to the
RenderPassEvent.AfterRenderingstage. This buffer can be set with the ARSessionBuffersHelper.AddAfterRenderingBuffer(camera, commandBuffer) method.
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.
For more information on how ARDK’s render pipeline runs under the hood: