Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Physically Based Sky [Feedback]

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

  1. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    16
    I'm surprised that there's no thread dedicated to the new PB-Sky yet, so I'll go ahead and create one.

    As of 2019.3, HDRP offers a new sky rendering that is physically based and although it's still experimental, it looks impressive so far.

    So let's start with the stuff that already works fine, before we take a look at some issues and missing features.

    Pros;
    • The rendering of the sky itself looks really realistic, especially at low sun altitudes the atmospheric scattering really shows off.
    • It finally works correctly with real light intensities (with matching Exposure PP), whether the sun (128000 lux) or the moon (0.33 lux), it just works.
    • Atmospheric scattering also effects surface illumination.
    To demonstrate the last point, I set the sun angle to 0° (so it's exactly on the horizon) and created a pillar with a height of 30 kilometers.
    Look how the color and light intensity changes depending on height.
    You just need to apply the initial intensity and color of a light and the scattering will do the rest!

    Cons;
    • As you can also see in the picture, the scattering only applies to the sky itself. The pillar was standing 30 km away from the camera and therefore the atmosphere should partly cover it, especially the lower part. Atmospheric scattering logically should apply to anything that's inside the atmosphere. You can kinda fake it with fog, but the required settings to do so almost always block the directional light completely, so that's no solution.
    • There are still some artifacts on the sky itself when the light is close to or below the horizon.
    • There is no inbuilt method to add clouds, if this wont be on the roadmap then please add the ability to author custom sky shaders based on the PBS.
    So that's it for now, let the discussion begin...
     
    Last edited: Oct 25, 2019
    konsic likes this.
  2. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    834
    I have a few questions..
    When we speak about athmospheric scattering, do we think on Rayleigh scattering or on exponential height fog ?

    Rayleigh/Mie theory affect only the color but often we see sunlight go through tiny particles, clouds and athmosphere so we see gradient colored exponential height fog too.

    I experience editor lag when trying to adjust PBS modules.
     
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,837
    Have you tried matching the volumetric fog component values to your physical sky values?
     
  4. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    16
    Rayleigh scattering is the light scattering by air molecules, responsible for the blue color of the sky and the orange-red tint on the horizon at low sun altitudes.
    Mie scattering on the other hand is the light scattering by aerosols, which applies in fog/clouds, in combination with forward scattering this shows up as the halo around a light source like the sun etc.

    I did try that, but as I told in my first post it will almost block the directional light from hitting the ground (that's what a 50 km layer of fog usually does).
    Fog also only do Mie scattering, so it's inappropriate.
     
    konsic likes this.
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,837
    Well, the volumetric fog with HDRP doesn't actually block light at all, it's a post effect of sorts. So the light hitting any surfaces will be the same as if it didn't exist.

    The Physical sky is only rendered as background skybox and will be picked up by reflection probes and shaders supporting sampling it like a cubemap.

    I'm not sure how that helps, only that I wouldn't expect a raytraced solution without raytracing enabled.
     
  6. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    16
    It's anything but a post effect, the volumetric fog is actually ray marched.
    And it does block light...
    The left scene uses a fog with a height of 10000 and a distance of 10000.
    The right scene uses the same fog height but a distance of just 100 and as you can see, the direktional light got completely dimmed.
     
    Last edited: Oct 24, 2019
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,837
    I recall the HDRP team posting that it doesn't in fact change the amount of light passing through, so what you see here is just an effect rather than a physical thing.
     
  8. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    202
    @SebLagarde are there any plans to support cloud rendering?
     
    Cascho01 likes this.
  9. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    16
    Ok i got the scattering working with an additional fog layer that just blends with the sky.
    It uses the same settings as the PBS(air settings);
    scattering.jpg
    Now I'll need another volume just for the "normal" fog itself, but I can live with that.

    EDIT
    Seems HDRP only supports one fog at a time, damn.
    So I'm stuck again. o_O
     
    Last edited: Oct 24, 2019
    konsic likes this.
  10. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    834
    In PBS air alttitude is in meters 58.3 and in Fog module height is in millimeters 58300?

    Is that right?
     
  11. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    16
    No it's kilometers for the PBS and meters for the fog.
     
  12. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    16
    So I finally set up a dynamic day/night cycle and applied space emission- and ground albedo textures (you can even use ground emission textures).
    The result is quite astonishing.


    However there are still some issues with the PBS;
    • High light intensity differences between light sources (sun/moon) results in color/exposure artifacts on the sky, especially when the sun is close or below the horizon, so I had to decrease the sun light intensity quite a lot from 128000 down to 128 lux in order to make it look acceptable (moon uses 0.33 lux). This might be partly caused by the automatic exposure values I use (min limit = 0, max limit = 12), which is necessary to deal with such great light ranges. I wonder how the HDRP team is going to handle it.
    • The atmosphere seems to be built of multiple layers which results in banding artifacts with low light angles (this is also quite visible in the video)
     
    Gokcan and konsic like this.
  13. YouDesign

    YouDesign

    Joined:
    Jun 21, 2017
    Posts:
    55
    What about clouds?
     
    Cascho01 likes this.
  14. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,123
    For clouds I use TimeOfDay Plugin which support is "frozen" since some month.
    We definately need clouds for all rendering pipelines!
     
  15. Tricktale

    Tricktale

    Joined:
    Jan 23, 2015
    Posts:
    27
    I've been playing around with this lately, trying to create a space scene timeline animation with the player moving close to a planet and entering its atmosphere. The PBS looks great when the planet size is big, but it makes creating a space scene impossible due to a floating point precision warning when placing objects.
    I've tried creating a small planet with a radius of 1km and fiddled with the settings as much as possible, but the results aren't anywhere near as good looking, with visible stepping and most of the effect lost when getting close to the planet. I'm assuming it's because it's all based on real-world values.

    Anyone else have any luck scaling down the entire effect to more manageable size?
     
  16. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    208
  17. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    13
    Hey there, I tried the new pbr sky shader but I'm wondering how can I enable to display the main directional light as a sun disk in the sky? For me, a clear sky without a visible sun is basically useless.
     
  18. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    834