URP Project & Quality settings: Learn from the URP 3D Sample

Hi everyone,

We have some good URP news this week!

First, we’re very happy to announce the availability of the Unity 2022 LTS version of the deep-dive technical e-book The Universal Render Pipeline for advanced Unity creators.


The 2022 LTS version of the URP e-book is now available to download.

The updates are threaded through almost every section of this latest edition of the guide – updated instructions for setting up and applying the myriad capabilities of URP, new links, images, and code snippets – so you can rely on it to match as accurately as possible your experience using URP in Unity 2022 LTS.

There are new additions and changes for areas like applying decals, URP quality settings and converters, comparing rendering paths to include Forward+, Full Screen Shader Graph including custom post-processing, LOD Crossfade, the SubmitRenderRequest API, and much more.

Along with the e-book, you can also watch a new video walkthrough of the recently released URP 3D Sample. The Sample was announced at Unite 2023; it’s available to download in the Unity Hub for versions 2022 LTS and on. The URP 3D Sample replaces the construction scene that will be familiar to many developers who have been using URP for a few years.

This recent blog post also provides a great introduction to the four distinct environments included in the sample and points you to a few additional resources you can check out to learn more about each environment.

Here’s a quick look at each environment:

The terminal

The garden

The oasis

The cockpit

You can get the Sample by starting a new 2022 LTS project and selecting the 3D Sample Scenes (URP) in the All templates list and open the project:

The rest of this post focuses on the project and quality settings available with URP. We’ll highlight the steps for where, and how, you can adjust quality settings for URP to suit your project, the different capabilities of the rendering paths available in URP, mobile-specific tips, and more.

The versatile project settings for URP

Our top goal is that URP is the main renderer for our users for their projects targeting mobile, XR, and untethered hardware, as well as for 2D.

One of the main goals with the URP 3D Sample is to illustrate, via each environment, how URP settings work on different devices.

URP uses two files, each with an Asset extension. The URP Asset provides settings to choose the quality level (high, mid, and low), lighting, shadows, and post-processing. You can use different URP Assets to set different quality settings.

This URP Asset (or “settings” asset), references the second file, the Renderer Data Asset via the Renderer List field.

Unity URP Assets_URP 2022 LTS
A URP Asset in the Inspector

When you create a new URP Asset, the Settings Asset will have a Renderer List containing a single item – the Renderer Data Asset created at the same time, set as the default. You can add alternative Renderer Data Assets to this list.

You use the Renderer Data Asset to filter the layers the renderer works on, and intercept the rendering pipeline to customize how the scene is rendered. This enables you to create high-quality effects.

Additionally, the Renderer Data Asset controls high-level rendering logic and passes for URP. It supports Forward and Deferred paths, and a 2D Renderer that enables features such as 2D Lights, 2D Shadows, and Light Blend Styles. Renderer features give you a way to add extra passes to a URP renderer, like ambient occlusion for shadowing in areas hidden from ambient light. You can even extend URP to create your own renderers.

Each environment in the Sample uses a Renderer Data Asset with settings to suit its particular lighting and effects.


The Inspector for UniversalRP_Renderer Data Asset

One way to understand their different roles: The URP Asset enables you to choose settings to suit your target hardware, while the Renderer Data Asset is for choosing other graphics settings that are independent of the hardware.

And regarding settings, that’s not all! URP splits its quality settings between Project Settings (under the Graphics tab) and the URP Asset. That said, the URP Asset is the principal way you can adjust quality settings, but some are in Project Settings, like some quality options for mobile and PC devices. The provides you with a versatile choice of settings and quality levels.

You’ll use the Renderer Data asset to switch between the rendering paths.


Choosing a rendering path

Let’s look at the different rendering paths available.

Forward Rendering

Forward rendering processes and renders each object one by one directly to the screen via the forward buffer. There’s no intermediate step or additional buffer where information is stored for later processing like there is in Deferred rendering.

Forward rendering has a limit of 9 lights, 1 main, and 8 additional. 8 lights may seem like a lot, but if you have a large mesh, like a spacious interior, or an exterior scene like the garden in the Sample, you have to split up your meshes in such a way to deal with the per object limit.

Forward+


The garden environment uses Forward + rendering.

The garden uses the Forward + path. Forward + removes the light limit and adds the ability to blend more than two reflection probes. Forward + is a good choice if you have a whole level that’s a mesh and you need flexibility for adding multiple lights per object.

Forward+ relies on the CPU to do significant culling operations per frame so it’s not always the best choice for low-end mobile devices. In that case, you can choose deferred rendering.

When using Forward+, a number of URP Asset lighting settings are overridden:

  • Main Light: The value of this property is Per Pixel, regardless of the value you select.

  • Additional Lights: The value of this property is Per Pixel, regardless of the value you select.

  • Additional Lights > Per Object Limit: Unity ignores this property.

  • Reflection Probes > Probe Blending: Reflection Probe blending is always on.

Deferred Rendering
In Deferred rendering, lighting is not calculated per object. Instead heavy rendering is postponed to a later stage and uses two passes.


Deferred shading path

In the first pass, or the G-buffer geometry pass, Unity renders the GameObjects. This pass retrieves several types of geometric properties and stores them in a set of textures (e.g., diffuse and specular colors, surface smoothness, occlusion, normals, and so on).

In the second pass, or lighting pass, Unity renders the scene’s lighting after the G-buffer is complete. Hence, it defers the shading. The deferred shading path iterates over each pixel and calculates the lighting information based on the buffer instead of the individual objects.

Here’s a chart comparing the three rendering paths:

Feature Forward Forward + Deferred
Max. # of real-time lights per object 9 Unlimited; per-Camera limit applies Unlimited
Per pixel normal encoding No encoding (accurate normal values No encoding (accurate normal values) Two options: (1) Quantization of normals in G-buffer (loss of accuracy, better performance); (2) Octahedron encoding (accurate normals, might have significant performance impact on mobile GPUs). For more information, see Encoding of normals in G-buffer.
MSAA Yes Yes No
Vertex lighting Yes No No
Camera stacking Yes Yes Supported with a limitation: Unity renders only the base Camera using the Deferred path; Unity renders all overlay Cameras using the Forward Rendering path


The four URP Asset settings that are available in the URP 3D Sample

Running the URP 3D Sample on a mobile device

The Sample includes a Mobile_High URP Asset in the Settings folder. As we wrote earlier, Forward+ relies on the CPU to do significant culling operations per frame, so it’s not always the best option for low-end mobile devices. Instead, use the Deferred renderer; this is the chosen rendering path listed in the Mobile_Low URP Asset in the sample project.


The Mobile_Low and Mobile_High URP Assets

In the Mobile_High URP Asset, the Renderer List has two Universal Renderer Data Assets: one for the active scene, Mobile_High_Renderer, and the other for rendering the screen scene, Mobile_High_ScreenRenderer. The Depth Texture is enabled. Note that the Cast Shadows option for Additional Lights is off. That’s because this is a very expensive option and for mobile devices that can be mimicked using light cookies. The garden scene contains numerous lights, many of which use cookies to mimic shadows. In the images below, left to right, you can see how the lighting on the rocks changes with and without light cookies.


Garden Scene Point Light with and without cookies

Here are three top tips when targeting mobile platforms.

  • Reduce the number of pixels rendered. Most modern mobiles have a high DPI or dots-per-inch count. For most games, a DPI of 96 is sufficient. If Screen.DPI is 300, for example, then a render scale of 96/300 on a 2400 x 1200 screen would mean rendering 768 x 384 pixels, almost a tenth of the pixels, which is a massive performance boost. You can set the render scale in the URP Asset or adjust the value at runtime.
  • In the image below, notice that the Forward+ renderer on the UniversalRP-HighQuality URP asset has a Decal renderer feature. The Technique option Automatic will switch to Screen Space on GPUs with hidden surface removal.

  • Use Deferred rendering on devices where the CPU overhead of Forward+ is too expensive.

A careful study of these four scenes alongside their URP Asset settings and documentation will help you learn how to use the techniques on display in your own projects.

We hope you pick up many new tips with these latest resources!

1 Like