Day 23 : Configuring AR Foundation with Scriptable Render Pipeline in Unity


Introduction

If you want to build AR apps with Higher visual fidelity and eye candy you are probably using or want to use Unity’s Scriptable Render Pipeline or SRP for short instead of the built-in renderer.

Until Unity 2018, ARKit and ARcore didn’t have support for SRP’s withing unity. Even with the earlier versions of the AR Foundation, the support was finicky.

But now, we have full-fledged support for both Lightweight Render Pipeline or LWRP and Universal Render Pipeline – URP.

In this article, we’ll look at setting up AR Foundation with both LWRP and URP, depending on the version of Unity you’re using. We’ll set up the SRP with the AR Background Renderer which is used by AR Foundation. This will work on both Android and iOS.

Note here that LWRP has been renamed and updated to URP. If you’re using any Unity version prior to 2019.3 it’s going to LWRP. From 2019.3 onwards it’ll be URP. You can read more about the migration here.

Also, once you set up the project using URP or LWRP, you won’t be able to use the built-in renderer. Since Unity is moving to URP as its default in future versions anyway. Moreover, HDRP isn’t supported as well. HDRP is more oriented towards desktop and console class hardware.

Getting Started

Prerequisites

  1. Unity 2019 or above
  2. AR Foundation 3.0.1 setup from an earlier article here. This article uses version 2, see here for upgrading to 3.0.1.

Using LWRP (below 2019.3)

Configuring Renderer

The first step is creating a forward renderer for LWRP.

Create a folder and name it Rendering. We’ll store our SRP pipeline asset here.

Now, inside the folder let’s create a new LWRP asset.

Right-click -> Create -> Rendering -> Lightweight Rendering Pipeline -> Forward Renderer

This is what it should look like

Next, we will add the AR background Feature by selecting the + icon under the Renderer features and selecting AR Background Renderer.

Creating LWRP Pipeline Asset

In the same rendering folder, create a new Pipeline asset by right click -> Create -> Rendering -> Lightweight Render Pipeline -> Pipeline Asset.

This is what the folder will look like

Select the Render Asset and change the Renderer type to Custom and click on the Data field.

This is where we select and pick the Custom Renderer that created earlier.

Configuring Project Pipeline Asset

Finally, go to Project settings -> Graphics and select the Pipeline asset we just created for the SCriptable Render Pipeline Settings field.

Using URP (2019.3 and above)

For URP it is fairly straightforward as well. Unlike LWRP we don’t have to create a separate Forward Renderer. URP does it for us.

Under the rendering folder create a new URP asset by right click -> Universal Render Pipeline -> Pipeline Asset (Forward Renderer).

This will create two new assets.

Select the _Renderer Asset and add an AR Background Renderer Feature

Finally, Go to project settings -> Graphics and select the UniversalRenderPiplelineAsset under the Scriptable Render Pipeline Settings property.

That’s about it. Now your project is ready for LWRP or URP.

Leave a Reply

Your email address will not be published. Required fields are marked *

Join 30 AR projects in 30 days and become a better AR developer
GET FREE LESSONS

Learn AR projects & source code

We shall send you an email with the link to the best starter lesson in 5 minutes
Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close
Download source code for this project & get updates of future projects
Download Source Code

Download Source Code

Close