Hi everyone,
We are still hard at work on URP with RenderGraph. Thank you very much for working with us, we are excited about our upcoming Unity 6 release.
I’ll get back to this thread with a few tips and tricks over the next weeks.
Today we start with Gbuffers.
The deferred renderer generates a few temporary frame resources called GBuffers (_GBuffer0, _GBuffer1, …). You can use the Render Graph Viewer to see the lifetime of those resources.
GBuffers store the material properties that are used for lighting in a later pass. This is a lot of data for mobile to store and load to the memory. Mobile GPU vendors have a specific GPU architecture to reduce memory bandwidth (and therefore energy consumption) called tiled rendering. To have the best performance with the deferred renderer, we need to make sure that the GBuffers are “memoryless” and not stored to memory. With RenderGraph this is now done automatically, and also easily set up in your extensions for other passes.
This type of optimization was already done before in URP. We had a single native render pass for the deferred renderer, hard coded. You could turn on native render passes on the URP asset. However, there were many cases where this was automatically turned off, for example when extending the render pipeline, to ensure correctness. With NRP, we also did not store the Gbuffers to memory.
Not storing to memory has implications though. This means there is no texture that can be sampled in the shaders. In older URP versions, when NRP was turned off, the GBuffers were bound as global textures as a way to share them between passes. In RenderGraph there is now a better way to do that without requiring global textures. I’ll share more on that in a later post. Shaders that sample these global textures will not work out-of-the-box with URP in U6.
However, you now have complete control to configure the lifetime of these resources through the RenderGraph API. We have created a sample to demonstrate how to bind the Gbuffers as global textures. This will automatically extend the lifetime of the textures to passes that use global textures. You can find the sample in the Render Graph package sample or see the code here. When adding that Render Feature to your renderer, you’ll see that the lifetime is extended and that the resources are not memoryless anymore. The textures are now available as global texture in every shader to sample. However, this comes at a GPU memory and performance cost on mobile devices.

