Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Refraction weirdness

Discussion in 'High Definition Render Pipeline' started by keni4, Jun 15, 2022.

  1. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    31
    Hi! I'm using Unity 2022.1.2f1, 2022.1.3f1, 2022.1.4f1 with HDRP 13.1.8, and found these bugs.
    1. Looks like refraction does not fallback to reflection probe baked cubemap. Also blur strength is constant regardless of view distance and geometry depth.


    2. Refraction flickering (reflection probe disappear) at the certain view angle


    This material uses Sphere refraction model, Reflection probe shape is Box and Use influence volume as proxy.
    I'm also would like to know if it any solution to make refraction strength based on depth? For example, object intersect a water surface, its underwater part should be distorted (and blurred) based on underwater distance (depth).
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    695
    Thanks for the detailled videos regarding the issues :).

    Can you provide a simple repro for this one? I'm not entirely sure what I'm looking at.

    For the second part, HDRP has no idea of the geometry depth (thus why you have to provide a thickness map or a fixed thickness), so it makes sense that the blur strength doesn't change depending on depth.
    For that you would have to make custom refraction using shader graph or custom passes.

    Finally, the lower the smoothness, the higher the mip of the color pyramid is used (to fake that blur). So the further you are from the transparent, the less pixels you have defining your transparents, making it a bit blurrier the further away you are from the transparent object.

    This one is known and tracked on our side, here's a tracker link if you want to follow the process.
     
  3. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    31
    Hi @chap-unity ! Thank you for the reply.
    Should I make bug report with tested scene? Or send it to you in other way?

    Hm, strange, but ok)

    Maybe in that case it would be a sence to bias mip level depending on distance to transparent object? Or have a checkbox or any king of slider for that. At lease for me it looks like to appear more "physically correct".

    Cool! Thank you!
     
  4. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    695
    Bug report is fine, as long as you send me the case number here when you do it ! Thanks :)

    I see what you mean, if it's really important to you, you can implement it in shader graph. Basically, lowering the mip the further you go from the object to not make it blurrier the further you go.
     
  5. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    31
    chap-unity likes this.
  6. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    695
    I've had a look and indeed there's no obvious reason why the refraction doesn't fallback to the probe cubemap where the screen space refraction fails.. :|
    your report has been converted into a bug and we'll look into it.

    Thanks for reporting
    Cheers.
     
    keni4 likes this.
  7. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    31
  8. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    31
    Hi @chap-unity
    This issue status changed to Won't fix. Can you explain me why?
     
  9. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    695
    So, technically, the issue arise when the result of the refracted ray end up behind the occluder (in your case, the big cube).
    In those cases, there's two solutions:
    1. We fallback on something else (we can't use the information from the color buffer because something is blocking the view) like reflection probe or sky.
    2. We don't refract and use the pixel from the color buffer as is.
    So, as you might have guessed, this is the solution #2 that has been preferred and this is what's happening.
    We could technically use reflection probe data, but there is a good chance that this information will be as bad as the solution #2 so a choice had to be made.
    Also, the main issue (having the border between the refracted ray and the fallback) will still remain in either solutions.
     
  10. keni4

    keni4

    Joined:
    Nov 30, 2014
    Posts:
    31
    Thank you for the reply @chap-unity
    I see, border likely will be there, but it will be border between distorted images, not between distorted-regular

    Also, is it possible to force refractions on the specific material use only reflection probe data?
     
  11. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    695
    Yes, exactly, both solutions have pros and cons, we just picked the one that made the most sense to us.

    For now, the fallbacks are indeed hardcoded (Screen space information, Reflection probe.. etc)
    While it could be possible in the future to let users chose the fallbacks they want, it can also introduce some other issues so it's not a priority for now :|
     
    keni4 likes this.