Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[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:
    887
    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:
    887
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    887
  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:
    887
    It was fixed in 7.1.6 where everything is in meters