Search Unity

  1. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  2. Unity 2017.1 is now released.
    Dismiss Notice
  3. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  4. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

translucent glass

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

  1. royter

    royter

    Joined:
    Sep 9, 2008
    Posts:
    341
    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:
    66
    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:
    3,241
  4. royter

    royter

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

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    3,241
    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:
    341
    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:
    3,241
    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.