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

translucent glass

Discussion in 'Shaders' started by flapyfox, Mar 16, 2017.

  1. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    I am looking to simulate opaque/translucent glass walls enclosing a conference room.
    Any guidelines on how to achieve this?
     

    Attached Files:

  2. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    A simple way (but not the best one) would be to use a GrabPass and blur the background.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
  4. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Ok, so no shader does that so far, have to write that myself?
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    There's no a shader that comes with Unity that does it, no. Frosted glass is one of the most difficult things to replicate realistically, especially in real time. It's something Disney puts out papers on every few years on what they're doing to fake stuff like it for movies, and that's with hours-per-frame render times. For games there's a number of techniques that get decent results from, and just blurring the stuff behind it is a popular one. The other is go with a translucent effect and just worry about lighting and not actually seeing what's behind it, like what Alloy, Lux, and Uber do, all of which I believe use some variation on this technique:
    https://farfarer.com/blog/2012/09/11/translucent-shader-unity3d/
     
    Last edited: Mar 16, 2017
    buttmatrix likes this.
  6. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Not looking for the exact physical effect (thikness + photons getting in and out..), just need to have something that simulates glossy refraction.

    btw, It doesn't take hours to render mia_materials it in mental ray were intoduced almost10 years ago and you could render a light scene in a few minutes with low samples.
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    That's because many of the mia_materials use fairly basic approximations quite similar to the real time ones we use today. The command buffer method in my first link is actually pretty close in terms of results to the way the Maya mia_material worked, though offline rendering would do with with multiple scattered rays per-pixel and the linked method does it by doing multiple blur passes of the currently rasterized scene contents. It's a bit less accurate, but cheaper and produces softer results with out needing to rerender the scene multiple times.

    Many recent offline rendering techniques actually started to use the similar idea of "just blur it in 2D", but the current state of the art for this has gone back to brute force raycasting and more up to date energy scattering models.