Migrating to Render Graph tutorial: The Render Graph viewer

The Unity’s Render Graph viewer

Hi. This is the first article based on the new upcoming series of video tutorials on understanding Render graph, the links can be found in the resources section at the bottom of this article.

The video series is now live.
<< WATCH THE PLAYLIST >>

In this article you’ll learn about a new feature in the Unity editor, the Render Graph Viewer window. This window first appeared with Unity 6. The Render Graph API gives a developer access to the render pipeline at any stage in rendering a frame. It automatically optimizes runtime rendering resulting in better performance. It also enables broader and safer access to the pipeline’s resources. Using the Render Graph API a developer can create many custom effects without sacrificing style for better performance or reliability.

To help understand the different stages that take place to render a frame in URP we created this chart that can be used as reference.


>> DOWNLOAD <<

When using the API it is important that a developer understands the impact of their custom features on the render pipeline. This is where the Render Graph viewer plays an important role.

You will get the most from this article If you follow along using the Unity Editor. The content uses Unity 6.2. First create a new project using the Unity Hub and the Universal 3D template. To keep things simple we’ll create a very simple scene.

  1. Create a new scene using the Basic (URP) template or simply use the existing SampleScene.
  2. Then add a Plane and a Cube.
  3. Set the y position of the Cube to 0.5.
  4. Create a new material. By default this will use the URP Lit Shader.
  5. Set the material colour to white.
  6. Apply the new material to the Cube.

Settings for the Main Camera Transform are shown below. But for the purposes of understanding the Render Graph Viewer, matching the Transform is unimportant. But you do need at least one object that is casting shadows.

You can bring up the Render Graph Viewer from Window > Analysis > Render Graph Viewer. You may need to switch between Scene and Game views to refresh the graph and click the circular arrow at top left of the window.

Render Graph is not a visual scripting system like Shader Graph or VFX Graph. In computer science, graphs are data structures with nodes and connections, and they allow us to understand and work with the system in a more intuitive way, like how we’re able to visualize the render pipeline here.

The top row of names contains the render passes in the order that URP executes them, and the left column lists the resources the render passes uses in the order that URP creates them. The grid with the colored blocks, these are access blocks that indicate how the render passes use the resources. Read horizontally, left to right, to follow the life of a resource and vertically, top to bottom, to view the resources used by a pass.

The table below describes the meaning of the colors used for a block.


Notice that some passes are grouped together. This is a feature of Render Graph wherever possible passes are grouped into a single draw call to improve performance. The blue lines and when a pass is selected the white blocks, indicate that URP has merged the passes above into a single, more efficient pass.

When a pass is selected in the top pass names row. The Pass List side bar on the right gives additional details. See the image above when Draw Main Light Shadowmap is selected. It explains which passes are merged and why the next pass to the right is not merged. Because the render target sizes do not match.

We’ll take a look at the life of the texture _MainLightShadowmapTexture. But first notice from the image above that the dropdown Pass Filter is set to Raster Passes, the default is Everything. This can help you focus on a specific issue. Also the Resource Filter is set to Textures, again a helpful option to simplify a complex graph.

The first colored block in the row of blocks for _MainLightShadowmapTexture:

  1. It is in the Draw Main Light Shadowmap pass.
  2. The main red color means the pass requires write access.
  3. The top left corner is blue which means on load, the texture is cleared.
  4. Bottom right is dark red which means the texture is stored.
  5. The globe icon means the texture is a global resource.

Now move along the row to the first green block. This is the Draw Opaque Objects pass and the green color means the pass requires read only access to the resource. As we move along the row the next pass that uses this resource is Fullscreen Mask. The green color again indicates read only access required. Same for Draw Transparent Objects and Draw UI. As you can see the viewer provides a lot of information. Let’s look at a custom renderer feature and how that is displayed in the viewer.

A project using the Universal Render Pipeline (URP) uses two settings assets. If you look in the Assets/Settings folder you’ll see PC_Renderer and PC_RPAsset. Take a look at PC_Renderer in the Inspector.

In the Renderer Features list you can see the Screen Space Ambient Occlusion, or SSAO, feature. This is active by default for the PC_Renderer asset using the Universal 3D template. If SSAO is new to you, ambient occlusion approximates the shadowing of ambient light we see in real life, anywhere objects or surfaces are close together. Let’s see where this feature sits in our render pipeline. Switch the Pass Filter from Raster Passes to Everything or just add Unsafe Passes to the options. You should now see the Blit SSAO pass in the passes list. Try turning the SSAO Renderer Feature off using the PC_Renderer Inspector. To see the updated Render Graph, we need to click the refresh icon. You might also need to switch to the Game view to capture our updated pipeline. The SSAO pass is no longer in the pipeline.

Turn the SSAO Renderer Feature back on and update the Render Graph Viewer. The SSAO pass is called the Blit SSAO. The source textures are the green access blocks. This SSAO pass reads the textures: _CameraTargetAttachment, _CameraDepthTexture and the _CameraNormalsTexture. These resources are processed to determine where the SSAO shadowing should be placed. Then it reads and writes to the textures: _SSAO_OcclusionTexture0, _ScreenSpaceOcclusionTexture and _SSAO_OcclusionTexture1.

The globe icon means that the render pass sets this texture as a global resource. Notice that the Draw DBuffer and Draw Opaque Objects passes have read only access to the _ScreenSpaceOcclusionTexture. Indicated by the green blocks. Then if we move on from there, we see that the Draw Decal Forward Emissive, Skybox and Copy Color passes ignore it. The Skybox is essentially infinitely far away, so shadowing doesn’t make sense. Shadowing is also not relevant for simple color transfers like the Draw Decal Forward Emissive and Copy Color passes. But after these, the texture is read again by the Draw Transparent Object pass. The reason for that is so transparent objects are blended correctly with the opaque objects behind. Suppose, in a game, you’re looking through a window. It would be wrong if the SSAO shadows disappeared on the objects behind the window. So the texture is used in this pass to maintain consistency in the scene.

The Render Graph Viewer is an important tool in optimising the rendering of your scene. You can use the viewer to gain a clear understanding of:

  • How URP manages and optimizes render resources.
  • Where performance bottlenecks (like redundant buffers or fragmented passes) may exist.
  • The flow of lighting, shadowing, and post-processing through clearly visualized pass-resource relationships.

Hopefully this article helps your understanding of how to get the best from this useful new window.

Resources

If you want to learn more about Render Graph don’t miss the recent resources that we published:

16 Likes

The video series is now live, you can watch all the videos in this playlist:

2 Likes