Search Unity

Shader that blurs out the edges of object independent of texture?

Discussion in 'Shaders' started by thePostFuturistUnity, Oct 28, 2013.

  1. thePostFuturistUnity

    thePostFuturistUnity

    Joined:
    Nov 16, 2012
    Posts:
    53
    Hello,

    Don't know much about shaders, have never written one, but I can't seem to find how to do something that would seem relatively popular.

    Looking to do something like this, whereas the beige area would be the alpha:

    $girl.jpg

    The edges need to blur/feather/fade out, while the center would be completely opaque — a radial blur.

    $blur.jpg

    Thank you for reading.
     
    Last edited: Oct 28, 2013
  2. brianasu

    brianasu

    Joined:
    Mar 9, 2010
    Posts:
    369
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    There is also my PostProcess Effects Pack with slightly more optimised vignette and couple more suitable effects together with 60 more.

    The pack will be in the 24 Hour Deals on November 01, 2013 with 50% off price.
     
  4. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    You might be able to do this using tex2DLOD and a mask texture?

    Might not look very pretty, but it wouldn't need Pro.
     
  5. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    How will you blur(EDIT: Efficiently) the background without render texture?
     
  6. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Ah, right. Yeah, you couldn't use tex2DLOD.

    I read the post as being for just that texture (or similar ones) rather than being applied to multiple objects.
     
  7. thePostFuturistUnity

    thePostFuturistUnity

    Joined:
    Nov 16, 2012
    Posts:
    53
    @Brianasu: These will affect all objects in the scene, I believe, I'm looking to blur out just a single one.

    @Aubergine: Does your shader provide a radial blur per object, not per scene?

    I think I might use this shader script for now, which simply allows for the alpha channel to be an independent texture.
     
  8. RC-1290

    RC-1290

    Joined:
    Jul 2, 2012
    Posts:
    639
    You could render the object you want to apply an image effect to with a separate camera that doesn't clear the screen (ClearFlags.Nothing), after rendering the rest of the scene regularly..
     
  9. omeys

    omeys

    Joined:
    Oct 29, 2015
    Posts:
    5
    The above comment saved my life. Thank you