Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Custom Post Processing

Discussion in 'Universal Render Pipeline' started by steve7987, Dec 7, 2023.

  1. steve7987

    steve7987

    Joined:
    Aug 28, 2019
    Posts:
    7
    I'm currently making an outline effect using a render feature that, after opaques have rendered, renders the outline layer to a temporary texture, and then before post processing, puts outlines on by sobelling that temp texture. This way I can write stuff like vertex colors and view normals to the temp texture to make nice outlines.

    There are two things I would like to do, that I'm not quite sure how to approach and mix together. One is, I think it would be faster to write my outline layer to both the camera buffer and temp texture using a single shader, but I'm not quite sure how to setup multiple render targets in the SRP and have my shader output different stuff (so can't blit) to them. Secondly, I'd like to be able to use a larger size temp texture (e.g. 2x the screen size) to make nicer outlines. Is it possible to have the shader write to two different textures with two different sizes?
     
  2. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    I would strongly recommend just writing to one texture, and then Blitting that result to the second one in another pass. Particularly if you're concerned with the smoothness of the outline, in your blit you could use a small blur or AA filter. Multiple render targets are already a pain (compatibility and API-wise) even when they are the same size.