1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

translucent glass

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

  1. royter

    royter

    Joined:
    Sep 9, 2008
    Posts:
    340
    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:
    35
    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:
    2,804
  4. royter

    royter

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

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    2,804
    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
  6. royter

    royter

    Joined:
    Sep 9, 2008
    Posts:
    340
    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:
    2,804
    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.