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

Frosted Glass (Blurry Glass)

Discussion in 'Shaders' started by RipcordDev, Jun 12, 2013.

  1. RipcordDev

    RipcordDev

    Joined:
    Jan 13, 2010
    Posts:
    40
    Hi Everyone,

    I've been searching around for a while now, but I haven't seen this one asked yet. Any advice on how to create a frosted glass shader?

    Something similar to this effect (Not my image):
    $frostedGlass.jpg

    Essentially anything that appears behind an object with the Frosted Glass shader would appear blurry. I've been working with shaders for a little bit now, but I have no idea where to start with this one.

    Any suggestions would be greatly appreciated.

    Thanks!
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    I think that ideally, one would be able to do this by post-processing a GrabPass before it is handed off to the shaders that use it. Unfortunately, I don't think there's any way of doing this at the moment.
     
  3. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Yes you need to use GrabPass and next apply some blur passes on you grabbed texture. And maybe use in addition a Diffuse map to have the frosted effect and maybe some normal.
     
  4. Lulucifer

    Lulucifer

    Joined:
    Jul 8, 2012
    Posts:
    358
    If you dont want to do post effect,or GrabPass, you can get scene depth and normals from _CameraDepthTexture or _CameraDepthNormalsTexture,
    only work with this,you can do limited effect similar to your post
     
  5. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Is this even possible in an efficient manner?
     
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    I don't think it is, since bluring the texture mean multiple grabPass call

    To Op, Btw using grabPass is not a bad idea actually, you can use grabPass and then distort it with some noise normal map in small size
     
  7. cherub

    cherub

    Joined:
    Apr 26, 2006
    Posts:
    493
    there's also more to it than blur. frosted glass is also somewhat back lit.
     
  8. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Backlighting is relatively easy in Unity. Blurring a GrabPass nicely isn't as far as I can tell.
     
  9. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    I'd try with the grabpass and just sample it 4-8 times in the main pass - basically you get some blur, but not tons.

    Might just work ;)
     
  10. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    If grabpass is read as a texture, you could use lower mip levels as well (I've never used it so don't know).
     
  11. RC-1290

    RC-1290

    Joined:
    Jul 2, 2012
    Posts:
    639
    Are lower mip levels even generated for grabpass textures?
     
  12. Drexster

    Drexster

    Joined:
    Feb 3, 2009
    Posts:
    20
    Any new developments or suggestions on achieving this?
    I've checked out Anamaria's Blur shader, which gives somewhat of the desired effect, but not 100%.
     
  13. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    You can make a shader that takes a screenshot each 4 points and make an interpolation of the colour between.
    Or a new camera that takes the screen shot in low-res and apply it as stretched texture.
     
  14. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    972
  15. OldManSmithers

    OldManSmithers

    Joined:
    Apr 30, 2017
    Posts:
    1