Physically Based Sky

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…

2 Likes

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.

Have you tried matching the volumetric fog component values to your physical sky values?

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.

1 Like

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.

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.

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.

@SebLagarde are there any plans to support cloud rendering?

4 Likes

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);

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. :eyes:

2 Likes

In PBS air alttitude is in meters 58.3 and in Fog module height is in millimeters 58300?

Is that right?

No it’s kilometers for the PBS and meters for the fog.

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)
7 Likes

What about clouds?

3 Likes

For clouds I use TimeOfDay Plugin which support is “frozen” since some month.
Devs for archviz definately need clouds + day-nightcycle based on long/lat for all rendering pipelines!

2 Likes

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?

1 Like

Related topic: [PBR Sky] Scale Unit?

1 Like

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.

https://forum.unity.com/threads/physically-based-sky-sun.768977/#post-5138234

This should be changed in final release.

1 Like

So with version 7.1.6 you can finally apply a surface texture to directional lights.
Moon

However updating the PBS became extremely slow with the recent update, simulating a day/night cycle is impossible now (it’s allmost 10 times as slow as before, both on the cpu and gpu).

6 Likes

I don’t know if it is because of PBR sky, but there is indeed 5 fps with Unity 2019.3rc1 and HDRP 7.1.6 when you are changing direction of light. Looking into profiler I see, that most of the time is consumed by Editor

1 Like