Search Unity

[PBR Sky] HDRP 7.1.5 isPbrSkyActive not correctly calculated

Discussion in 'High Definition Render Pipeline' started by iamarugin, Nov 17, 2019.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    There is a code in PhysicallyBasedSkyRenderer

    Code (CSharp):
    1. float r = Vector3.Distance(builtinParams.worldSpaceCameraPos, pbrSky.planetCenterPosition.value);
    2. float R = pbrSky.planetaryRadius.value;
    3.  
    4. bool isPbrSkyActive = true;//r > R; // Disable sky rendering below the ground
    here planetary radius and planet center is in km, but worldSpaceCameraPos in m, if I understand correctly, which will lead to incorrect results.
     
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Haven't look at how the code it but aren't they converting the km value into meters? Is the saved value in km or m?
    Perhaps it is only displayed in the editor as a km value. Otherwise you could convert the camera value or the other values to match the formula.
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    It was fixed in 7.1.6 where everything is in meters