Day 31: Converting Render Pipeline

Japji Multani
4 min readFeb 10, 2023

--

Last time, I laid out a sci-fi room. Today I’ll convert the project from using the built-in render pipeline to using the Universal Render Pipeline (URP).

URP

What is a render pipeline? From my understanding, it’s a bunch of operations that determine how the contents of a Scene are displayed on the screen. According to the unity documentation, there are three main stages to the render pipeline that happen sequentially:

  • Culling — The render pipeline figures out and creates a list of objects that need to be rendered. It’ll try to grab objects that are visible to the camera and unoccluded (not hidden) by other objects.
  • Rendering — The render pipeline does a bunch of operations to draw the list of objects into pixel-based buffers.
  • Post-processing — The render pipeline does additional operations on the pixel-based buffers. For example, using the Post Processing Stack v2 to add post-processing effects such as bloom or chromatic aberration.
https://docs.unity3d.com/Manual/BestPracticeLightingPipelines.html

What’s a pixel-based buffer? I’m not 100% sure and I hope someone will correct me if I’m wrong, from my understanding it’s a region of memory to temporarily hold data while it’s being moved from one location to another. The closest thing I found on Google was about a framebuffer.

From what I read, the frame buffer is the memory that stores color values for each pixel on the display. The memory can be part of the VRAM on a GPU. This pixel data in the frame buffer is constantly being pushed to our monitors at a specific rate. Rates can be 60hz, 120hz, 240hz, etc. So when we are playing a game like Overwatch 2 at 120hz, pixel data is being pushed from the frame buffer to the monitor 120 times per second.

With that being said, Unity has its built-in render pipeline, which is what I have been using. They created a new feature called Scriptable Render Pipeline (SRP) which allows users to control the rendering through C# scripts. One of the render pipelines they created using SRP is the Universal Render Pipeline (URP). Compared to the built-in render pipeline, URP is supposed to offer better performance and is a more extensible solution.

https://docs.unity3d.com/Manual/BestPracticeLightingPipelines.html

Upgrading the Project

To change my project’s render pipeline, I’ll first export my Scene into a unity package and import it into a new Unity project made with the URP template. Doing it this way lets me keep a backup of my project.

URP Template in Unity Hub

To export my Scene, I’ll navigate to it within my Project window, right-click on the Scene, and then click Export Package from the context menu. This’ll prompt me to a window with all the items that’ll be exported into the package. I’ll export the scene and all its dependencies and save the package in an external folder.

Right-clicking on the Scene and exporting the project.
Export Package prompt

Then, I’ll open up the Unity Hub and create a new project using the URP template. Once the project is loaded, I’ll click and drag the package I created into the Project window to import it. I’ll import everything using the prompt.

Importing package from a built-in renderer project to a URP project

Everything is imported, but it looks…pink. This is happening because the Materials assigned to the MeshRenderer components are using incompatible shaders. URP has its own set of shaders that need to be set for the Materials. What is a shader? From my understanding, a shader is a program that is executed by the GPU which manipulates the image before it’s drawn onto the screen. One way we can update the Materials is by selecting all the Materials in our Assets folder and then from the navigation bar, go to Edit > Rendering > Materials > Convert Selected Built-in Materials to URP. To make the selection of materials easier, we can use the Search By Type feature in the Project window to select all the Materials in the Assets folder.

Updating Material Shaders

Now the project is converted.

--

--