Search Unity

Question URP vs HDRP Reflection Probe

Discussion in 'General Graphics' started by osmank_02, Jan 14, 2023.

  1. osmank_02

    osmank_02

    Joined:
    Oct 16, 2020
    Posts:
    18
    Hello, my question is about the difference between reflection probes of HDRP and URP. For example, when I place my reflection probe in a sunlit area in URP, I get bright spots (caused by normal map) in the shadowed areas but that's not the case with HDRP (check the screenshots). I wonder what HDRP does to avoid this and is it possible to avoid it in URP? In general, reflections always seem a little too bright in URP imo. (Unity version 2020.3.43f1)

    Both projects are almost same (SSR is disabled in HDRP, Infinite projection in both, AO disabled)

    URP:
    urp reflections.png
    HDRP:
    hdrp reflections.png
    Reflection Probe location:
    probe location.PNG
     
    Last edited: Jan 14, 2023
  2. Minos321

    Minos321

    Joined:
    Jul 7, 2018
    Posts:
    37
    Good question, also wondering the same. I converted my project to URP and now it's really hard to control the reflections. They always look way too bright. Is it because URP does not use a physically based rendering?
     
  3. osmank_02

    osmank_02

    Joined:
    Oct 16, 2020
    Posts:
    18
    URP uses a physically based rendering most of the time but the shaders are more optimized so they don't have advanced shading model like the HDRP. For example specular model is very different and I think it is what causes reflections to be that bright. I couldn't find a proper solution with my limited knowledge of shader code so I implemented this into BRDF.hlsl (By moving "com.unity.render-pipelines.universal@version" folder into Packages folder of the project so it is modifiable) with the help of ChatGPT:

    Find "half3 EnvironmentBRDFSpecular(BRDFData brdfData, half fresnelTerm)" function and replace it with this:

    Code (CSharp):
    1.  
    2. // Computes the specular term for EnvironmentBRDF
    3. half3 EnvironmentBRDFSpecular(BRDFData brdfData, half fresnelTerm)
    4. {
    5.     // Adjust the Fresnel term based on the roughness of the surface
    6.     // You might need to fine-tune these parameters based on your specific requirements
    7.     fresnelTerm *= 0.65 - brdfData.perceptualRoughness;
    8.  
    9.     float surfaceReduction = 1.0 / (brdfData.roughness2 + 1.0);
    10.     return half3(surfaceReduction * lerp(brdfData.specular, brdfData.grazingTerm, fresnelTerm));
    11. }
    12.  
    BRDF.hlsl is located at com.unity.render-pipelines.universal@version\ShaderLibrary

    This calculation reduces the fresnel of the reflections in the areas of the surface that is rough.

    My URP version is 14.0.10
     
    Bezoro, PutridEx and Minos321 like this.
  4. Minos321

    Minos321

    Joined:
    Jul 7, 2018
    Posts:
    37
    Thanks for the answer, that seems like a good solution. I will give it a try and report back later. I wonder if someone knows a way to accomplish this without having to move the Package files into assets? This way when the project gets updated in the future to a new URP version, things won't break.
     
    osmank_02 likes this.
  5. Minos321

    Minos321

    Joined:
    Jul 7, 2018
    Posts:
    37
    Thanks, that alleviates it a bit! Not the cleanest solution, but good for now :) Comparison shots:
     

    Attached Files:

    osmank_02 and JamesArndt like this.
  6. osmank_02

    osmank_02

    Joined:
    Oct 16, 2020
    Posts:
    18
    Nice! I'm glad it works for you.