AnyPortrait > Advanced Manual > Universal Render Pipeline

Universal Render Pipeline

Universal Render Pipeline (URP) is a new rendering method introduced in Unity 2019.3.

URP replaces LWRP and supports more platforms and devices, and can be applied to various projects such as 2D, 3D, VR and AR.
 

We recommend that you refer to the following pages for further explanation.

- Material Library

- Creating Materials with Shader Graph

- Custom Shader

- About the Universal Render Pipeline Manual

Setting Up the Universal Render Pipeline and Changing Materials

AdManual_870.jpg

Run "Window > Package Manager".

(The location or name of the menu may vary depending on your version of Unity.)

AdManual_871.jpg

(1) Select the "Universal RP" package.

If you don't see the package in the list, it may take a while to load, so wait a moment.

(2) Press the Install button.

AdManual_872.jpg

Once the URP package is installed, you need to create a Pipeline Asset and apply it to the rendering.

Right-click within the Assets folder or select from the Assets menu, and select "Create > Rendering > Universal Render Pipeline > Pipeline Asset (Forward Renderer)" .

AdManual_873.jpg

"UniversalRenderPipelineAsset" is created.

Also "Default Renderer Asset" is created that defines how to render in URP.

AdManual_874.jpg

Let's apply the generated URP Asset to the project.

(1) Open "Edit > Project Settings" in the Unity Editor Menu and select the Graphics item.

(2) Assign the "UniversalRenderPipelineAsset" created above to the "Scriptable Render Pipeline Settings" item.

Now it's rendered in URP, probably because most materials won't render properly.

AdManual_875.jpg

Let's install and apply a material that supports URP.

(1) Open AnyPortrait Editor and select one of the Root Units.

(2) Press the Material Library button.

(3) Select the package you want to install. In this case, select the URP Presets package.

(4) With URP Presets selected, press the Unpack Preset button.

AdManual_876.jpg

Once the package is installed, you need to run the Material Library again.

Press the OK button and press the Material Library button to open it again.

AdManual_877.jpg

Three material presets with URP support have been added.

- URP Unlit : This is the material that renders the original color without lighting in URP environment.

- URP Lit : This is the material to which lighting is applied in URP environment.

- URP 2D Lit : This material is applied by 2D Light in URP environment with 2D Renderer.

AdManual_878.jpg

Let's create a material set with the added material presets.

(1) Press the Make Material Set button.

(2) Select one of the URP presets. In this step, select the URP Unlit preset.

(3) Press the Select button.

AdManual_879.jpg

(1) Select the created URP Unlit material set.

(2) Press the Default Material button to set it as the default material.

AdManual_880.jpg

Because clipping masks are rendered differently in LWRP and URP, you need to do additional work in Bake setup.

(1) Press the Bake button.

(2) Select the Setting tab.

(3) Change the value of the Render Pipeline item to "Scriptable Render Pipeline".

AdManual_881.jpg

(1) Select the Bake tab.

(2) Press the Bake button.

AdManual_882.jpg

If you look at the character in the Unity scene, you can see that they now render correctly in the URP environment.

Applying URP Lit Material

You can apply URP Lit materials to make the character be rendered with lights.

AdManual_883.jpg

Open the Material Library.

(1) Press the Make Material Set button.

(2) Select the "URP Lit" preset and (3) press the Select button.

AdManual_884.jpg

(1) Select the created URP Lit material set.

(2) Press the Default Material button to set it as the default material.

When you're done, close the Material Library.

AdManual_885.jpg

Run Bake and see it in the Unity scene.

AdManual_886.jpg

Unlike the Unlit material, the character will be a bit darker than the image above, or it will be black.

This is because Lit materials are dark without light.

AdManual_887.jpg

Let's add various kinds of Light objects.

AdManual_888.jpg

When you run the game, you will see a lighted character.

Rendering in URP with the 2D Renderer

URP is a way to include the features of LWRP 2D.

You can simply apply the 2D Renderer to switch to the rendering method using 2D Lights.

AdManual_889.jpg

Create a 2D Renderer asset.

Right click on the Assets menu or the Assets folder,

Select "Create > Rendering > Universal Renderer Pipeline > 2D Renderer (Experimental)".

AdManual_890.jpg

New 2D Renderer Asset (New 2D Renderer Data) is created.

AdManual_891.jpg

(1) Select the "UniversalRenderPipelineAsset" created earlier.

(2) Assign "2D Renderer (New 2D Renderer Data)" to the items of the Renderer List.

(3) The lighting is not applied to the characters in the Unity scene since the material for the 2D Renderer has not yet been applied.

Let's set up a material for URP 2D.

AdManual_892.jpg

It is almost same to the method described above.

(1) Open the Material Library and press the Make Material Set button.

(2) This time, select "URP 2D Lit" preset and (3) press Select button.

AdManual_893.jpg

(1) Select the created URP 2D Lit material set and (2) press the Default Material button to set it as the default material.

AdManual_894.jpg

Run Bake and see it in the Unity scene.

AdManual_895.jpg

As it is a Lit material, the character looks dark in a scene without light.

Currently basic Light objects are placed, but separate Light objects for the 2D Renderer are needed.

AdManual_896.jpg

Add a 2D Light object.

In the "Light > 2D" category, there are 2D lights of the kind supported by the 2D Renderer.

AdManual_897.jpg

Place 2D Lights to the scene.

AdManual_898.jpg

You can see the beautifully rendered character in the URP 2D environment.

Shader Graph assets with URP support

AdManual_899.jpg

When the URP Presets package is installed from the Material Library, shader assets that support URP are added as shown above.

(Assets > AnyPortrait > Assets > Shaders > Advanced folder)

These assets are created by Shader Graph.

AdManual_900.jpg

Open these assets to see the contents of the Shader Graph.
Materials provided as presets only perform basic lighting.

Create your Shader Graph based on this asset and apply various rendering techniques.

< Cautions for using URP materials >

URP is a new feature introduced in the latest version of Unity 2019.3.

URP has many advantages in rendering, but there is a big problem with incompatibility.

Therefore, unlike the previous version of AnyPortrait, URP materials are provided in the form of Shader Graph.

However, please note the following limitations due to the limitation of the function of Shader Graph.

1) Soft Additive is not supported. Instead, Additive's Shader also applies to Soft Additives.

2) Multiplicative method of mesh blend method is calculated as Multiply method, not 2X Multiply.

3) In URP 2D Lit, Additive (Soft Additive) and Multiplicative materials are not affected by light.