[URP MRT] Original Material Displays Corrupted by Multi-Render Targets
Under Audit
Unity 2021.3.x - Unity 2023.2.x
Published 25 days ago
Users porting projects from Built-in Render Pipeline (BIRP) to Universal Render Pipeline (URP) face challenges implementing multiple render targets (MRT) while preserving individual object materials.
Porting projects from the Built-in Render Pipeline (BIRP) to the Universal Render Pipeline (URP) presents challenges, specifically regarding the implementation of multiple render targets (MRT), which lacks out-of-the-box support in URP. Custom render passes within URP and the Scriptable Render Pipeline (SRP) are often predicated on the assumption that a single material will be used for all rendering operations within that pass. However, the requirement is to enable multiple render targets for a scene containing numerous objects with diverse materials—all utilizing compatible shaders—without mandating a single material across the entire render pass. The straightforward Camera method for specifying multiple render targets and a separate depth target, which was available in BIRP, does not have an immediate or obvious equivalent in URP. The primary concern is whether enabling multiple render targets in URP necessitates a complete rewrite of the existing batching and sorting systems.
- Implement a custom
RendererFeatureto inject your ownScriptableRenderPassand explicitly manageRenderTextureattachments for multiple render targets. - Investigate using
CommandBufferto explicitly setRenderBuffertargets and draw individualRendererobjects with their original materials, potentially iterating throughRenderersin the scene. - Ensure your shaders are correctly configured to write to multiple render targets using
SV_Target0,SV_Target1, etc., and that they are compatible withURP.
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.