Search Unity

Blur effect shader Graph ?

Discussion in 'Shaders' started by skyLark9, Mar 3, 2019.

  1. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    135
    Hi
    I looking for Blur shader for my main menu image. I found many of tutorials but the problem is all looks pink in my LWRP scene. So, could any one provide a tutorial or screen shot for shader graph tree ?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    The old grab pass style blurs are not possible with the LWRP or even HDRP as they’ve removed support for grab passes. The closest option is the opaque texture.
    https://github.com/Unity-Technologi...ines.lightweight/Documentation~/lwrp-asset.md

    To use this in a Shader Graph you need to add a “_CameraOpaqueTexture” texture property to the blackboard (make sure you modify the reference value to be _CameraOpaqueTexture as well), then use the screen space position for the UVs. Depending on how you set the opaque texture, it may already be blurred to some extent. However note that unlike a grab pass, it really is only a texture of the opaque objects, so any transparent objects in the scene will not be visible through this shader.
     
  3. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    135
    OK. Do you have a tutorial for this one ?
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
  5. skyLark9

    skyLark9

    Joined:
    May 2, 2018
    Posts:
    135
    Nothing simple. Thank you bgolus.
     
  6. garza

    garza

    Joined:
    Dec 18, 2013
    Posts:
    30
  7. vvafterglow

    vvafterglow

    Joined:
    Aug 3, 2019
    Posts:
    1
  8. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
  9. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    123
  10. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
    Not at the moment, as the pipeline is still in preview. When it is stable, I would try to support it if it isn't too convoluted, and there is enough demand.

    Usually, studio big is enough to make use of HDRP would need a senior graphic engineer anyway, so the demand for third party asset is lower.
     
  11. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    @Le_Tai I was trying to use your asset, but I need to be able to work with Screen-space Camera canvases. Can you advise if/how this would be possible?

    My Layout is:
    [Background Canvas]
    - Background Image (needs to be blurred)
    [Foreground Canvas]
    - Animated 3D UI elements (hence the screen-space camera requirement)
     
  12. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
    @Dover8 The type of canvas shouldn't matter, you just need to make sure the order of rendering is right. As I understand, you want to put Translucent Images on Foreground Canvas? If that the case, you have to make sure the Background Canvas is rendered first, by setting it to Screen-space Camera, and make sure it's Camera's depth is lower than Foreground's.

    If you want Translucent Images in both Canvas, then you need 3 Camera, in this order: scene > bg > fg. Translucent Images on each canvas should reference Source in the lower camera, so one in bg canvas should reference scene, and those on fg should reference bg.

    The frame debugger tool is very useful in this case - you can see how the rendering happen, why it have to be like this, and make troubleshooting will be easier.

    Oh, and if you use LWRP, this is not straightforward yet, as the pipeline haven't support stacked Camera (they say it will, but no clear release date). One way to workaround this is to set the Cameras to render to a target texture, assign these texture to quads, and move those quad in 3d space manually to emulate ordering.

    On another note, it don't feel right to use someone else thead to provide support for my asset. So, if anyone want to contact me, please use my support portal or email.
     
  13. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    83
    Hi! I have a similar setup! An isometric map of a city, then blur layer, then a popup. I used to just put a frosted glass on the "blur layer" but without grabpass, that shader is dead. Did you find a simple solution in LRP?
     
  14. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    I ended up using a shader graph and a render texture to create the effect.
     

    Attached Files:

  15. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    83
    I use a classic shader that is a frost glass + a screenshot utility :( thanks for sharing your solution!
     
  16. Spacec

    Spacec

    Joined:
    Nov 7, 2018
    Posts:
    1
    Hey! Turns out that if you change the surface type to transparent, plug Smoothstep node with default values into Alpha input of Lit Master, you can control blurriness by changing the smoothness value of Lit Master. It works like that: you put this shader on a Sphere, and anything inside that Sphere is now blurry, depending on the smoothness value of the Sphere shader.

    I don't think it is effective in blurring images, but still.

    works in 2019.1
     
    Last edited: Dec 31, 2019
  17. prashantmgk

    prashantmgk

    Joined:
    Sep 8, 2018
    Posts:
    2
    It didn't work while using with LWRP in Unity 2019.2.19f1