Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Feedback Physically Based Sky

Discussion in 'High Definition Render Pipeline' started by SebLazyWizard, Oct 23, 2019.

  1. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    You images seem overexposed, is it also visible with more normal exposure ?
    The LUTs are kept quite lowres otherwise it would take even more vram than it already does, but from our testing it was not too noticeable with regular settings
     
  2. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    The changes shouldn't have affected the ambient probe
    When changing it to static, it's gonna use the settings from the environement tab of the lighting window, so if it's not set to have the pbr sky from your scene, the lighting will not match but it's expected
    However than screenshot is very weird i didn't manage to repro, do you have more details on your setup ? (or maybe you can report a bug if you think something is going wrong)
     
  3. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    indeed seems to be a similar issue, if you could share the project in a bug report i can investigate the issue
     
  4. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    Looks like I found something while toggling various options when trying to reproduce the issue.

    'Dynamic Render Pass Culling' is enabled in the Global Settings. Most of the time, the problem starts to appear when I enable 'Volumetric Fog' in the 'Fog' component. Then I need to disable the 'Dynamic Render Pass Culling' in the Global Settings to resolve it. Then I can re-enable 'Dynamic Render Pass Culling' again.

    Looks like the problem is not visible at all and can't be triggered when 'Dynamic Render Pass Culling' is turned off.

    BTW. 'Dynamic Render Pass Culling' toggle needs to be pressed twice before it's changed. Same for other toggles and drop-downs. It happens only for the first 'click' afer entering the inspector for Global Settings. Looks like it only happens if it's opened in the inspector and won't happen while accessing it in the project settings.
     
    Last edited: Nov 20, 2023
  5. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    thanks i managed to repro :)
     
    sqallpl likes this.
  6. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    It looks fine with "daylight" exposure, but as soon as you set it to 5 or below the banding becomes very noticable;

    exposure: 12
    exp12.JPG

    exposure: 4
    exp4.JPG

    So its still not possible to achieve visually good looking day to night transitions.

    In Hillaire's implementation per-pixel transmittances and non linear mapping (page 14/15) has been used to combat visual banding, maybe it's worth to take another look into it;
    https://blog.selfshadow.com/publications/s2020-shading-course/hillaire/s2020_pbs_hillaire_slides.pdf
     
  7. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    I could be wrong but i don't think the issue is banding here, i'd say it's because there is not enough slices in the LUT.
    The use case we support is what you do in the first screenshot, the second one is clearly overexposed and solving these artefacts is not worth the performance cost. Is it really something you want to do or are you testing extreme settings just for testing ?
     
  8. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    It would be the best case scenario if it would work for low light scenarios (transition to a realistic night sky) out of the box, but I can artificially reduce the sunlight when it gets below the horizon to hide these artifacts. This is what I do with the earlier implementation anyway.

    Here comes just another issue I've came across;
    There's no option to define the earthshine color on moons, it now assumes that the earth has a pure white albedo.
    So an option to define it's color would be nice.

    Can we also have normal map support for moons?
     
  9. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    959
    I feel a little silly asking this but how do I actually activate the night sky? I just upgraded to 2023.2.0 (to my surprise nothing broke), and I can't see any options regarding this. If I remove my space texture it still goes completely black once the sun goes under.

    I can't find any documentation about it either.
     
  10. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    indeed we forgot about earthshine color. I don't think using the ground albedo for that is the right solution, so maybe we could add another setting.
    Same for normal maps, i can write that down as an improvement to consider
     
  11. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    We don't have a pbr sky sample scene yet sorry about that, but night sky isn't really something you enable
    It's basically just making a custom sky shadergraph that you reference here, in which you can do procedural stars for example without relying on an ultra hd cubemap
    And second is in the celestial body section of the directional lights, there are new options to make moons or other stuff in the sky
    upload_2023-11-21_20-26-4.png
     
    Wolfos likes this.
  12. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
    Atmospheric scattering in 2023.3 looks strange:
    With:
    upload_2024-1-10_14-59-18.png

    Without:
    upload_2024-1-10_15-0-5.png

    It gets yellowish tint no matter what the sun angle is. It should be actually bluish (like it is prompted in the atmospheric scattering hint).
    The tint changes when you change camera relative angle, which is wrong
     
  13. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    I noticed the same, it's very obvious on distant clouds. It seems to work fine to a certain distance and then start to break for some reason.
    schattering.jpg
     
  14. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
    I've opened the case: IN-65715 but I have very low expectations, if it even gets noticed.
     
  15. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    Indeed the atmospheric scattering LUT only goes up to a fixed distance (128000m for now, it's defined in PhysicallyBasedSkyEvaluation.hlsl)
    There is an issue when the distance is farther than that that i am gonna fix (it's missing a clamp), but even with that it's still not gonna be the perfect result
    The main solution i see would be to have a dynamic max distance based on the height of the camera for example, but then you start to have banding issues when interpolating over slices of the LUT

    This is the clamp fix i mentionned if you wanna try in the meantime. I expect it should solve the issues you have but tell me if it doesn't, then i can look into something more advanced maybe.

    float entryPoint = max(IntersectSphere(_AtmosphericRadius, cosChi, tFrag).x, 0);
    tFrag = min(tFrag, entryPoint + ATMOSPHERIC_SCATTERING_MAX_DISTANCE);

    upload_2024-1-12_18-21-15.png

    This gives this now:
    upload_2024-1-12_18-24-25.png

    while before:
    upload_2024-1-12_18-26-8.png
     
  16. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
    It looks much better, but that orange glow is still noticable. I will try to migrate my space game to this Unity version and then provide more feedback and comparision screenshots of this and old atmospheric scattering (it was turned off before but could be easily enabled back).
    Also maybe it worth making ATMOSPHERIC_SCATTERING_MAX_DISTANCE as a function of planet radius, because larger planets would have longer line of sight trough the atmosphere?
     
  17. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
    So I've updated my project to Unity 2023.2b2 and applied the fix you've suggested. Looks like it just removes atmospheric scattering after sertain distance entirely.

    Here is two screenshots from 30km and 60km above the ground:

    sample_shot.png

    sample_shot2.png

    Meanwhile the old atmospheric scattering that was commented out for some reason in Unity 2022.2.15 and prior, works flawlessly.

    Untitled.png

    Untitled2.png
     
  18. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    Ok it doesn't work either. I tried a bunch of things and it's not possible to get rid of all the artifacts even with more complex LUT mappings
    The old scattering was commented in earlier versions because it's quite expensive, and has a static costs on transparents (which may be bad for VFX)
    Next week i'll look into adding an option in the ShaderConfig package to force using the more expensive old scattering (maybe for opaque only, and probably disabled by default), it's probably the easiest option solution
     
  19. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    502
    How UE handles this? I remember seeing perfect screenshots of earth from outer space when they've implemented their physical sky.
     
  20. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    not sure, maybe they switch to raymarching after a certain height. That would also make sense and allow to keep cloud shadows, but not sure how expensive that would be, i can try it
     
    SebLazyWizard and TerraUnity like this.
  21. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    502
  22. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Sebastian Lague manage to implement that sky in his game, he explain it here
     
  23. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
    Also I didn't feel that old scattering was very expensive for PC, I've never fall bellow 60 fps with full scale planet, ocean and atmosphere (+scattering) rendering even on GeForce 970.

    It would be great to have old scattering on transparents too (even just commented out), otherwise any water surface will not receive scattering and it would look not great.
     
  24. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    So i added to the existing shader option called PrecomputedAtmosphericScattering in the HDRP config package, so that when it's disabled the atmospheric scattering uses the old luts, which are more expensive but have correct result when camera is in space (when camera is on the ground, there's no difference)
    For info the added cost on PS4 is around 0.5ms on the defered lighting pass, 1ms for the fog pass, then additional cost per pixel for transparents which have 'receive fog' enabled

    This has not landed yet, but the configuration will go through the config package which can be configured as explained here
    https://docs.unity3d.com/Packages/c...-a-project-using-the-hdrp-config-package.html
     
  25. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
    I will try it out as soon as it will land! Thanks!
     
  26. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    There is an issue with the lighting of objects.
    It seems that the atmospheric lighting evaluation is completely dependent on the camera's position instead of the object's position, which ofc results in totally incorrect lighting.
    lighting1.JPG lighting2.JPG
    This worked just fine in the earlier implementation.
     
  27. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    889
  28. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Oh, yes I see... I just thought it was to fix the incorrect coloring of the atmosphere viewed from space, but it fixes the lighting too.
     
  29. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    326
    Yes the change wasn't necessary related but we choose to put them under the same option as usually if you want one, you want the other, so it reduces the amount of settings
     
    SebLazyWizard likes this.