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

Selective post-processing effects

Discussion in 'Shaders' started by lucidcoder, Nov 21, 2010.

  1. lucidcoder

    lucidcoder

    Joined:
    Mar 23, 2010
    Posts:
    138
    Hey guys,

    I have a two-camera set up for rendering in an FPS-style project, where the viewmodels (the guns and arms) are rendered by one camera on their own layer, and the remaining geometry is rendered by another camera, so that the viewmodels never appear to intersect with level geometry, no matter how close the player cameras are to other level geometry.

    Given the above, I want to have a blur effect applied to the viewmodel camera similar to that of the blur post-processing effect, so that it appears to only affect geometry on the Viewmodel layer--however, when I use the blur effect on the viewmodel camera, it appears as if it is applied to all of the cameras.

    I suspect that the reason for this is that post-processing effects take the final image being rendered by cameras and apply their shader effects to the final image, before passing them to the GUI renderer (so that GUI elements are not affected).

    All this being said, is it possible to have a camera effect such as the Blur effect applied only to certain objects in the scene; especially those on their own layer?
     
  2. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! There is no easy way to do this. Currently I'm looking for the solution myself. I suppose, I need to render all cameras to texture, apply effect to every texture, and then combine them at the end. That is the only way I can think of.
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    depending on the effect thats the way to go yes.
    For some though shader replacement might work as well
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Its interesting how often that feature is forgotten especially due to the last thing in the list, the softparticles, as well as per object glow
     
  5. lucidcoder

    lucidcoder

    Joined:
    Mar 23, 2010
    Posts:
    138
    I suppose a hacky solution would be to use the per-object glow script and switch out the glow shader for a blur shader?