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

Shader that excludes image effects

Discussion in 'Shaders' started by EpsilonBetaGamma, May 25, 2016.

  1. EpsilonBetaGamma

    EpsilonBetaGamma

    Joined:
    Nov 18, 2013
    Posts:
    33
    Hi!
    Is it possible to make a shader that won't be affected by fullscreen image effects, or just one particular effect?

    Thanks!
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    An image effect applies to a rendered image. So when you add a blur to your camera, it will draw the scene as normal then blur that image. You can't exactly make a shader or object that ignores an image effect, but you can use command buffers or custom render queues to make sure your object is drawn after the image effect is applied so that it can't affect that object. http://docs.unity3d.com/Manual/GraphicsCommandBuffers.html

    Another thing you can do is draw to render textures; anything that you want an image effect applied to goes to to one render texture, and the rest go to the other. Apply the image effect to your first render texture, then render them both to the screen. This will be tricky if you're not savvy with the graphics pipeline because you'll likely need to share a depth buffer between render textures to make sure objects that should be obstructed from the camera view aren't rendered on top. http://docs.unity3d.com/Manual/class-RenderTexture.html
     
  3. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    You could also use the stencil buffer to mark pixels that should be skipped. It depends on the full screen effect whether this leads to the desired result. It would work for a color grading fullscreen effect for example.