Search Unity

Question Moonlight in HDRP Physically Based Sky

Discussion in 'High Definition Render Pipeline' started by Deleted User, Mar 19, 2023.

  1. Deleted User

    Deleted User

    Guest

    I'm having difficulty getting proper moonlight when using a Physically Based Sky in Unity 2022.2.11, HDRP v14.0.6.

    The light intensity cheat sheet (attached) is very helpful, however while a Lux value of 0.5 dims the directional light to a decent night-like intensity, the colour temperature of the moon (4100K) still produces a mid-day look on the overall scene.

    Also, the directional light Celestial Body in the sky still looks exactly like the sun, instead of the moon.

    1. How do you get a properly moonlit scene using the Physically Based Sky without adjusting the colour filter of the directional light, or making nonsense temperature values?

    2. How do you make the directional light Celestial Body "moon-like" in appearance without changing the surface/flare tint from white?
     

    Attached Files:

  2. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Difficult to get a good night scene with physical sky currently, in the HDRP roadmap there are plans to improve this situation and get better night scenes with physical sky.

    But currently, one idea is to use an HDRI, or a fullscreen shadergraph -- you can usually find one in the HDRP samples (go to package manager > HDRP > click samples > fullscreen samples (or fullscreen shadergraph samples).

    There you will get an example of a shadergraph to create a nice looking night sky, but it does that by creating a custom sky texture, so not really physical sky.


    For physical sky, you can get a moon texture and put it on the sun, to make it look more like the moon, and finally do cold temperatures. Doing crazy temperatures isn't bad, game dev is mostly hacks to get things working :D
     
    Deleted User likes this.
  3. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,191
    Bump. I'm not sure how the settings were before, but now there is a Body Type option where you can select Star or Moon.

    You can set the moon to use an "Automatic Moon Phase" or a Manual One (where you can set the Moon Phase and Moon Phase Rotation), however the Automatic mode doesn't seem to work correctly, or I am just not using it right.

    It says the sunlit portion of the moon will be calculated from the position of the main directional light, which is strange since you normally don't move the position of the main directional light, only its rotation.

    Yet moving the position or changing the rotation of my sun does nothing to the moon's light, it is just fully bright as if the sun is hitting it directly at all times. In contrast, deactivating the automatic mode and adjusting the moon phase and moon phase rotation values does change the look of the moon, giving it nice earth shadows.

    Perhaps the issue is that the main light (my sun in this case) needs to be defined some where? Otherwise I'm not sure how the moon is determining which light is the main one (although in my case there's only two lights, the sun and moon, so logically it should be able to determine that the sun in the main one).
     
  4. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    143
    I fiddled with it, and went back having 'old' scheme having basically two suns but one set as moon.
    Current "Physical Night Sky" - as stated in road map, it's exactly the same sun but with moon phases and moon texture. That's it.
    And it's currently bugged (as of 2023 beta) it's flickers and randomly disappears, so yeah.
     
    soleron likes this.