Search Unity

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

Question Is it possible to apply culling to an image effect that uses a command buffer?

Discussion in 'General Graphics' started by MartinIsla, Oct 28, 2020.

  1. MartinIsla

    MartinIsla

    Joined:
    Sep 18, 2013
    Posts:
    104
    Hey guys!

    I'm using CommandBuffers for the first time to create an outline effect for a 2D game. It's exciting and I'm having lots of fun. This is how it works:

    Unity draws transparents:
    upload_2020-10-28_6-39-57.png

    My command buffer draws an "OutlineMap" using a silhouette-only shader:
    upload_2020-10-28_6-40-20.png

    OnRenderImage in the camera applies the outline using the OutlineMap:
    upload_2020-10-28_6-40-46.png

    So far so good.
    Now what I'd need is to cull the outline so, in the example above, it wouldn't be visible in front of the red-haired character. Would that be possible?

    Thanks!