Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

exclude an object from a fullscreen shader?

Discussion in 'Shaders' started by mezzostatic, Oct 3, 2016.

  1. mezzostatic

    mezzostatic

    Joined:
    Aug 18, 2016
    Posts:
    13
    is it possible to exclude an object from a fullscreen shader, while all other mesh and shaders are viewed through the fullscreen shader? perhaps using another camera through the first one?
     
  2. ClementCapart

    ClementCapart

    Joined:
    Oct 3, 2015
    Posts:
    4
    It will depend a lot on your constraints but you can indeed use several cameras, render one in a RenderTexture and then in your post effect shader, merge the RenderTexture with your scene rendering.

    Another possibility is to use the stencil buffer, but only if you are using forward rendering, as the stencil buffer is cleared before post effects in Deferred.
    If you can use that, just change your specific objects shaders so that they write some value in the stencil buffer. Then in your post effect, if the stencil is equal to that value, just don't do your post effect pass.
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,349