Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Fragment shader outputting multiple colours to multiple render targets in URP

Discussion in 'Shaders' started by MrYadaization, Jul 4, 2022.

  1. MrYadaization


    Apr 3, 2015
    Hello, I'm looking for some advice on the following:

    I have some opaque objects to render with a specific material, but I also want them to output some info from that material that I can use for post processing later in the pipeline.

    If I output multiple colours using:

    struct f2a { float4 col0 : COLOR0; float4 col1 : COLOR1; };

    How can I access this info later? Is it possible to tell the DrawOpaqueObjects stage to output to an additional target, or do I need to use a custom render feature? I'm a bit apprehensive about using a render feature because then I would be rendering my opaque objects twice.

    I'm using Unity version 2021.2.7f1