Search Unity

Feedback Physically Based Sky

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

  1. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    580
    hard to believe that about the previous sky because it was ridiculously simple.

    Perhaps someone convinced someone that it is so. :)

    As for "the current situation", I don't want to get into it.
    This thread about the sky and production needs of the majority of the users regarding this feature..

    I will just repeat what must be repeated:
    For busy people, soon is maximum 2-3 months.
    Not 2-3 years.

    In two years most serious developers have turned in at least 3 medium scale projects. Or at least 8 small ones. And having to do that while the competition can spit out things faster and/or better is not really a joke.

    Someone saying "you do not have to use Unity" is amateurish at least.
    If not idiotic.

    Studios have invested a lot of time and money to hire and train people and create specific pipelines and in this competitive world most small studios can't afford investing either to learn a new engine and realign their pipeline. Thinking or saying so is like spitting at your users. Huge disrespect thrown around in a multitude of ways.
     
    MP-ul likes this.
  2. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    So with HDRP now "out of preview", whatever that means these days, there are still several issues with the PBS.

    1) Day/night cycles with realistic light intensities for both the sun and moon are still not accomplishable without graphical errors. At first we still have the banding artifacts on the atmosphere layers at low light angles. And then there's the automatic exposure (well it becomes visible with it) which just can't handle the extreme differences in light intensity before sunrise and after sunset, which results in an over-exposed bright circle (towards the sun position) on an otherwise dark night sky.
    transition.jpg
    Case 1225204

    2) Fog isn't taking the spherical planet into account and blocks any sun/moon light if it's altitude is below zero. High altitude objects/surfaces like clouds or mountains are not illuminated at all even if you can clearly see the sun from up there. It works as expected if fog is turned off.
    Case 1225209

    3) The celestial body of a directional light seems to be excluded from bloom, instead you added the "Flare" option which in my opinion looks way worse than real bloom and has nothing to do with physical based rendering at all.
     
    Last edited: Mar 4, 2020
    soleron, ftejada, valarnur and 5 others like this.
  3. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    I also noticed the banding for new sky shader. It looks really ugly like you take a screenshot and decreased the color depth to 256 bit without checkerboard dithering. Why are they no smooth transition between the colors?
    For a "physically based sky" this looks not reaslistic at all and it will mostly destroy the feeling of any game trying to convince the photorealistic look.
     
    MP-ul likes this.
  4. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I like the Physically Based Sky look. However I can't seem to move the Sun through the sky without massive lag (terrible performance). Is there a different or default way of moving the Sun (i.e. day/night cycles) with it?
     
    MP-ul likes this.
  5. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    You shouldn't update it's position every frame, but do it periodically.
    Depending on how long a day cycle takes you can update it like every 10 seconds or so.
    I really needed a "step-free" transition and ended up with an update once every second with a day/night cycle taking real 24 hours.
    At this rate you can't see any difference to a per-frame update.
    But again the needed update rate really depends on your specific use case.
     
    MP-ul likes this.
  6. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Even if I put a 10 second timer on it, I get a massive lag spike every 10 seconds. I tried decreasing the increment on the x axis transform position of the Sun, and I can still notice a large performance hit in-game.

    I think I might have something checked in my HDRP settings that maybe I'm not supposed to have checked. The profiler keeps telling me it has something to do with the UpdateSkyEnvironment script that Unity is using and perhaps CubeMaps (or updating of the sky cubemap). I'm using Procedural Sky right now though......I didn't think I was even using CubeMaps at all.

    Still can't figure it out.
     
  7. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    I assume the refresh of the cubemap is very expensive, like updating a realtime reflection probe because the sky shader has a setting called bounces and therefore updating every frame a graphical object that has to calculate 10 bounces seems very heavy. So you may increase the performence if you do not set the bounce count to high. If not it seems like a huge design flow for a realtime engine. Other games and engines can update too in a tight frame budget, and they even have to calculate the clouds.
     
    Velo222 likes this.
  8. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Bounces does not recompute on changing light direction.
     
  9. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Hi, okay I've been trying to get the Physically based sky to work on a real spherical planet, for around 4 days now, for the life of me I can't get the blue tinting Aerosol to work, like in SebLazyWizard video, the tutorials say it even takes in effect mountains and objects, but I'm seeing nothing, no atmosphere effect at all, and it's not like there are millions of settings, it's set to how all the limited examples say to set it. Can someone who has this working provide correct environment settings for this to work? Thanks.

    Unity 2019.3.5f1
    HDRP 7.1.8
     
  10. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    There is no atmospheric scattering fog atm in PBS.
     
  11. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    No the manual states that PBS has Mie Scattering, started by SeblazyWizard, and his video demonstrates this atmospheric scattering effect?
    From the unity manual:

    The Physically Based Sky’s atmosphere is composed of two types of particles:

    • Colored air particles with Rayleigh scattering.
    • Monochromatic aerosol particles with anisotropic Mie scattering. You can use aerosols to model pollution, height fog, or mist
     
  12. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Atmospheric scattering consist from two parts: sky color and fog for opaque and transparent objects. You still need to generate precomputed tables for Rayleigh and Mie scattering to get a physically correct color of the sky. The same tables could be used for computing fog color and opacity but currently it is not implemented in HDRP.
     
  13. adamb70

    adamb70

    Joined:
    Sep 12, 2018
    Posts:
    9
    Since you can only have directional shadows from one light source at a time, what's the recommended way to handle a day/night cycle with sun and moon? My first thought is to disable the sun shadows when it dips below the horizon and enable moon shadows, but unless the moon is directly opposite the sun (also at the horizon) there's going to be a sudden pop in of moon shadows.
     
  14. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    You can just tweak the shadow dimmer setting of the light during the day/night transition.
    But with real sun and moon light intensities you dont really need to do that, because even if the sun is already below the horizon the skylight intensity is still way higher than the moon light, so moon shadows aren't visible for a good amount of time after sunset.
    I use light intensities and colors of the sun and moon before their light hits the atmosphere (sun: 128000 lux, moon: 0.5 lux), the atmospheric scattering of the PBS itself controls the final light intensity and color.
     
  15. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    I don't have Sky and Fog volume in the hiearchy but sky is still there.
    Should the sky not exist without Sky and fog volume?
     
  16. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    HDRP uses the default volume settings if there are no active volume overrides.

    So back to topic.
    I recently watched a video of Unreals new sky atmosphere system, which is basically the PBS, but way ahead in terms of features and visual quality (no banding artifacts).


    Especially the volumetric cloud system looks quite promising and I'm wondering when the planned cloud-system for the PBS might appear.
    Is there any news on that? We've been waiting for so long...
     
    MP-ul likes this.
  17. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
  18. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    and there is new realistic water shader but I don't know if for 7.4:(
     
  19. adamb70

    adamb70

    Joined:
    Sep 12, 2018
    Posts:
    9
    I made a post about the pull request for water that was in progress before the SRP repo moved to Graphics and all the pull requests were deleted. I don't know if the guy who was working on it is still around though, maybe @SebLagarde will know more?
     
  20. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
  21. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    It is just a texture.
     
    Bordeaux_Fox likes this.
  22. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Well, while there is no official build-in water asset for HDRP, I say you can make your own with Shadergraph and Custom Passes. Of course this requires some fundamental understanding of shaders and SRP and general lighting of water.
    But you know, water is mostly just a plane with really dense vertex or tesselated. Put a good wave normal map and a reflection cubemap on it plus some depth fog. Foams are just depth intersections with a seperate foam texture. I think an average developer can make a decent water with Unity.

    For the waves, either implement vertex animation with Gerstner waves in the shader or with a C# job. There are a lot of examples of vertex manipulation with C# jobs. Of course you can implement it with a normal script, but for heavy vertex manipulation, I recommended doing the work on another CPU core (C# jobs multithreading).

    Also iamarugin is right. It often looks very complicated but it's mostly just a texture generated with a mix of noise algorithms.
     
    Last edited: May 15, 2020
    MP-ul likes this.
  23. srsface

    srsface

    Joined:
    Dec 11, 2016
    Posts:
    5
    The fact that the Physically Based Sky renders completely black when the camera goes under the horizon has a consequence also on Planar Reflection Probes. I spent all evening trying to figure out why the probe breaks when my camera goes high enough. Turns out the culprit was the Sky volume, must be something to do with how the Planar Reflection Probe's camera offsets according to the player's location. Had to do a stupid hack of lowering the sea level in the Sky asset to get around it for now.
     
    ftejada and adamb70 like this.
  24. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Are we going to get PBS like this ever?
    Especially when most of the unity features are already lacking the stability needed to be actually reliable for production
     
    shikhrr and ftejada like this.
  25. Nothke

    Nothke

    Joined:
    Dec 2, 2012
    Posts:
    112
    Wow, that image on the pull request really looks like something from the 90s "GPU gems":



    I made my own clouds using a few noise layers a while back when PBS came out: https://twitter.com/Nothke/status/1188997624680108033. It is only a surface effect tho, "painted" on the ground, because I only needed views from orbit, it's not 3d. I was hoping Unity would come up with a better solution in the mean time so didn't bother to improve. Well, I'm prepared now to be disappointed.

    The sun disc also boggles me. It's called PBs but the sun disc is the most un-PB thing ever. It has a simple un-physical fading. Why is it LDR? It seems to peak at at the same intensity as the sky. Increasing sky exposure increases the sun brightness proportionally. Instead, it should rely on physically correct bloom for the "fade".
     
    Ofx360 and Ruchir like this.
  26. adamb70

    adamb70

    Joined:
    Sep 12, 2018
    Posts:
    9
    I've been wondering about sun brightness too. It seems the specular reflections from the sun are brighter than the sun disc itself, with bloom turned on I will get a lot of blooming on reflections but none on the actual sun disk itself.
     
  27. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Yes, sun disk feels not right.
     
  28. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    It worked fine in previous versions of the pbs, but then they introduced the "Flare" feature which kinda replaced real boom on the directional light... And it looks totally wrong in a physically based manner ofc, no idea why they did this.
     
  29. Stonext

    Stonext

    Joined:
    Jan 31, 2017
    Posts:
    2
    How do you change the position of the atmosphere to make it work with floating origin?

    sky.planetCenterPosition = new Vector3Parameter(planetPos);
    doesn't appear to do anything but change the numbers shown in the editor.
     
  30. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    Is the camera dropping to a negative y value disabling physical sky a bug ?
     
  31. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    No, it was intended. Decrease the planet radius to the lowest point, where player could be.
     
  32. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    sorry I’m not following, I’m new to HDRP
     
  33. Nothke

    Nothke

    Joined:
    Dec 2, 2012
    Posts:
    112
    No. Just make sure your camera never goes below the ground. The "ground height" is the planet radius of PBS. So, either reduce the planet radius, or lower the planet position Y, or raise the level in scene.

    Like this:

    Code (CSharp):
    1. public Volume volume; // Assign your volume here
    2. PhysicallyBasedSky pbs;
    3.  
    4. private void Start()
    5. {
    6.     profile = volume.profile; // makes a copy of the profile, so we don't edit the "asset"
    7.     profile.TryGet(out pbs);
    8.  
    9.     // this "ticks the box", next to the value, making it changeable:
    10.     pbs.planetCenterPosition.overrideState = true;
    11. }
    12.  
    13. void Update()
    14. {
    15.     pbs.planetCenterPosition.value = -yourCartesianPosition;
    16.  
    17.     // or (in which case you don't need to explicitly overrideState in Start):
    18.     pbs.planetCenterPosition.Override(-yourCartesianPosition);
    19. }
     
    Stonext likes this.
  34. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    What if I have an actual spherical planet at origin? Moving the whole planet up is not an option at this point
     
  35. Nothke

    Nothke

    Joined:
    Dec 2, 2012
    Posts:
    112
    If the planet is supposed to be at origin, then you will need to move your PBS planetCenterPosition relative to the camera in update
    pbs.planetCenterPosition.value = -cameraPosition * scale;
    . You'll also probably want to block the camera from going inside the planet.
     
    Coalescer likes this.
  36. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
  37. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    How can I activate the Volumetric Cloud volume override in 2021.2a8? I can only see the Cloud Layer volume override.
     
  38. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    Bartolomeus755 likes this.
  39. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    283
    Ah ok, thank you. I hope Unity migrate it soon.
     
  40. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
  41. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    How did you add the clouds visible in the sky?
     
  42. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    It was just a flattened half-dome mesh with a special shader applied to it, however I'm not using it any longer as this solution was quite limited.
    Soft cloud shadows were impossible (HDRP still doesn't support semi-transparent shadows) and simulating correct light scattering within the clouds using an unlit shader was a tough task since receiving matching light data (especially in combination with the PBSky) was a big hassle.
     
    Ruchir likes this.
  43. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi everyone!!
    Does anyone know where I can find a list of changes / fixes / improvements between versions of PhysicsBasedSky?

    I have looked at the docs for the different versions of HDRP, but there is little or nothing coming.

    Greetings
     
  44. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Anyone who knows where to look or if there is a document like the one I mention?
    Greetings
     
  45. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    Well you could track it's related commits at github:
    https://github.com/Unity-Technologi...igh-definition/Runtime/Sky/PhysicallyBasedSky
    But unfortunately there's not much to explore recently...

    The PBS still suffers from poor/glitchy rendering at twilight (dusk/dawn) and it has been like that since it's very first release.
    That prevents us from implementing proper day/night cycles.
    I guess it's essential to implement an ozon layer to get the lighting right, as described here; (starting from 3.4)
    https://media.contentapi.ea.com/content/dam/eacom/frostbite/files/s2016_pbs_frostbite_sky_clouds.pdf

    I would also like to see render texture support for the surface texture of directional lights, this way we could implement dynamic moon phases for example. (atm I have to pre-render different moon phases and switch their textures at runtime)
     
    ftejada likes this.
  46. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    atmospheric and mie scattering needs to be implemented in PBS or refactor
     
  47. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    233
    Not sure what you mean by that, since rayleigh and mie scattering are the core principles of the PBS.
     
    Ruchir likes this.
  48. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    In the latest versions of HDRP 11 and 12 I see a very important loss of performance in the twilight and sunrises ... and I do not know why it occurs.

    Unity starts a lot of new features and they always leave them in the middle, with a lot of bugs ... or it takes years and years to get those features ready for production.

    It's unfortunate about Unity for a few years
     
  49. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    How the relation of sunlight intensity and physically based sky is designed? Do I need to manipulate the sunlight intesity manually based on its angle or does the sky component adjust it automatically so one fixed value should be used (for example 120,000 lux for realistic values)?

    EDIT: just tested it once again properly and looks like the intensity is adjusted automatically.
     
    Last edited: Sep 7, 2021
  50. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Yes, leave it at 130,000 lx at all times to get the correct intensity under the atmosphere based on the sun angle.

    upload_2021-9-7_13-12-37.png

    See full diagram here:
    https://docs.unity3d.com/Packages/c...ight-Units.html#lighting-and-exposure-diagram
     
    TerraUnity likes this.