Search Unity

ColorMask in second RT slot disables blending?

Discussion in 'Shaders' started by lemrysroberts, Apr 4, 2020.

  1. lemrysroberts

    lemrysroberts

    Joined:
    Mar 8, 2020
    Posts:
    1
    Hi.

    I have a render-setup that writes to color target, but also a second render-target which I use to track certain material IDs. These are both bound during a pass and behave as expected under normal circumstances.

    For a particular effect, I wanted to mask a channel of the ID target to prevent it being over-written. I used ColorMask in my shader to achieve this, as I've done before with non-MRT setups.

    Unfortunately, it appears that using the MRT ColorMask syntax (i.e ColorMask RGBA 1) disables blending for the second render-target.

    I confirmed this in RenderDoc by adding the ColorMask to my shader with all channels enabled for slot 1 (as in the above sample), which should theoretically be identical to not setting ColorMask at all.

    The output merger showed the following:



    Is this expected behaviour?