Denoiser and URP Render Graph Context
Under Audit
Unity 2022.3.x - Unity 6.0.x
Published 2 days ago
Integrating the Unity Denoiser with URP's Render Graph is challenging as the denoiser requires access to ScriptableRenderContext, which the Render Graph does not directly expose. Additionally, the input texture's GraphicsFormat must be R32G32B32A32_SFloat to avoid crashes.
When attempting to utilize the Unity Denoiser within a custom rendering pipeline integrated with URP's Render Graph, a dependency on ScriptableRenderContext is encountered. Specifically, the CommandBufferDenoiser.WaitForCompletion() method mandates a ScriptableRenderContext parameter, which is not directly accessible or exposed through the Render Graph API. Initial attempts to retrieve this context via reflection led to crashes, which were later identified to be caused by an incorrect GraphicsFormat of the input texture. The Unity Denoiser explicitly requires the input image to be in GraphicsFormat.R32G32B32A32_SFloat. While correcting the GraphicsFormat resolves the crashes, the fundamental problem of properly obtaining and supplying ScriptableRenderContext to the denoiser method within the Render Graph execution flow persists.
- Ensure the input texture used for denoising is explicitly set to
GraphicsFormat.R32G32B32A32_SFloat. - Consider refactoring your custom rendering pipeline to utilize
ScriptableRenderPasswithin yourRender Graphpasses, which might offer more direct avenues to access or manage rendering context. - Investigate official
Render GraphAPIs in newer URP versions for utility methods designed to safely provide ScriptableRenderContext forCommandBufferoperations.
Editor's Note:
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.