Search Unity

Apply post process Blur to specific cameras / layers

Discussion in 'Shaders' started by gonzorob, Oct 18, 2014.

  1. gonzorob

    gonzorob

    Joined:
    Dec 1, 2011
    Posts:
    96
    Hello,

    In an 2.5d isometric game, I'm trying to blur out the floor above and below the players floor.

    I'm using a camera with a culling mask for each floor. The drawing order: Lower Floor, Player Floor and Upper Floor.

    When the player goes up or down a floor, the current floor should blur and the destination floor become clear. This means each floor must blur independently of one another (not blur everything behind it).

    My initial idea was :
    1)Camera for each floor
    2)Camera.Render() each and capture RenderTexture
    3)Apply post process to Lower and Upper RenderTextures
    4)Merge the three (? No idea how to do this)
    5)Display result on main camera (? not really sure)

    Is this a sane way of doing things? If so, does anyone have any good pointers on combining RenderTextures? I read here (http://technology.blurst.com/camera-render-with-shader/) about a technique to combine textures via a material. Unfortunately source for the shader wasn't supplied.

    Any help would be greatly appreciated

    Rob
     
  2. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    You can check my blur per object package which does what you want (you can selectively blur individual objects).
    EDIT: It does even support transparent objects.
     
  3. gonzorob

    gonzorob

    Joined:
    Dec 1, 2011
    Posts:
    96
    Looks good! Quick question: the example image looks like only the textures are blurred - are the edges of the object also blurred? I'm looking to apply a strong gaussian to the lower floor and a lesser one to the upper floor :)

    EDIT: took a leap of faith and purchased - as feared, all edges are hard :( any way of changing this?
     
    Last edited: Oct 19, 2014
  4. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    Well, it is a generic solution. But i offer to customize it for your needs. Please use the assets forum thread or the email supplied in the readme file. (There is already a smooth edged version if you follow the assets forum thread)
     
  5. gonzorob

    gonzorob

    Joined:
    Dec 1, 2011
    Posts:
    96
    Brilliant, will switch threads :)