Search Unity

Blurry edges when looking at glass

Discussion in 'High Definition Render Pipeline' started by Leniaal, Dec 3, 2019.

  1. Leniaal

    Leniaal

    Joined:
    Nov 7, 2012
    Posts:
    58
    Hi,

    I made a simple glass material with the HDRP lit shader and I'm having this strange blurry effect at the edges of my camera. It happens to both my editor and game view camera.

    I disabled lighting and all the scene settings, but it still occurs. I also tweaked a lot on my glass material, but nothing really seems to have an effect. I hope anyone else understands where these edges come from and could point me in the right direction.

    Material:
    upload_2019-12-3_22-21-24.png
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    620
    Hi @Leniaal,

    As far as I have understood, it's artifact of the screen space refractions that are used to create the refraction effect. That artifact becomes very obvious if you make a quad and go close to it so that it touches the borders of your editor or camera view. Then you will see that fade there on the edges.

    Check this manual page for information about refractions:
    https://docs.unity3d.com/Packages/c...definition@6.9/manual/Refraction-in-HDRP.html

    It's always best to first to try isolate the problem using as simple test case as possible. Things like complete humanoids or vehices are not ideal...
     
    Last edited: Dec 3, 2019
  3. Saaskun

    Saaskun

    Joined:
    Nov 29, 2019
    Posts:
    4
    Same problem for me, I'm using HDRP 7.1.6 in Unity 2019.3.0
    This Unity example doesn't present that problem:

     
  4. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    620
    Hi @Saaskun,

    I think you are interpreting some of the things in the video wrong or haven't understood completely how that works?

    For starters, how have you configured your materials? That sphere that is shown for a long time in Unity's demo video is using Sphere mode for it's refraction. this is a critical difference how the result will look like.

    That fade is required to avoid artifacts appearing on the edges of the screen (afaik) ?

    See this simple test scene I set up:

    HDRP_refraction_mode.png

    It's best to go read the manual to grasp the details etc.
    https://docs.unity3d.com/Packages/c...definition@6.9/manual/Refraction-in-HDRP.html

    There's a Screen Space Reflection Override too (which you add to your Volume), which provides some controls. Dial the Screen Weight Distance down and I think it will make the fade go away, but I'm not sure if it's artifact free... Anyway I'm sure it will look 10x better than that grey band.
     
    Last edited: Dec 9, 2019
  5. Saaskun

    Saaskun

    Joined:
    Nov 29, 2019
    Posts:
    4
    I'm using the Sphere refraction model with an index of refraction of 1.016, the bottles has liquid inside them, if I increase the refraction index the liquid doesn't look realistic :(
     
  6. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    620
    Well it sure doesn't look like it. Try dialing down that Override weight? And to be honest, maybe you just have to somehow fake it, as it often is with game engines.