How the Light & Night light system works

Hello everyone,

I’m sorry in advance if the subject seems rather basic, but I’ve been trying to understand for several days now and despite a lot of research and attempts, I can’t figure out how to set up what I want.

What I’d like to do :
Overall, what I’d like to do is a sort of Day/Night Cycle, but I’m having a lot of trouble getting a completely black scene.

Let me explain:
I’m using the default Directional Light to manage the skybox, and I’m using its rotation to manage the position of the sun.
As you can see on the screen below, with a rotation of 90 for x during the day and 220 for night.


However, when I compile and change the x rotation manually or via a script, the rendering is absolutely not the same for night.

If someone could explain clearly how to get the same result as the first two screens but when compiling, I’d be extremely grateful.

Thanks again to all those who have read and who can answer me.
Thank you

1 Like

You need to lower the directional light’s intensity at night time as well, set it to 0.05 and that would make it darker even after compiling shaders.

Well, changing the intensity level has no effect.
So I’m not sure what the problem is (I should point out that I’m working on a new project for version 2022.3.11f1).

Is my unity screwed?
Maybe in the project parameters or in the global config ?

You should probably talk to someone who’s good at all that kind of stuffs, anthonydavis57k on Instagram will help you with all you issues

Look closer at this sphere mesh:

image

What you see here is not an influence of directional light but reflection map’s contribution to surface brightness & color.

What it means here is that you render night time using a day time cube map. To fix this set LightingEnvironmentSun Source field to this Directional Light and this Default-Skybox shader will start generating a cubemap that matches given light orientation.

image


Also, in case you need a sun controller script: basic sun controller script · GitHub

Well, I already had the settings indicated as you put them in your screen, but the problem remains the same, unfortunately.

Then the problem is that this cubemap is either not updating for some reason (project setting) or you are overriding it somewhere a reflection probe. Either way, reflection cubemap is the problem, 100%.

Is skybox changing colors following light rotation change?

skybox functions as default reflection cubemap

Then the problem is that this cubemap is either not updating for some reason (project setting) or you are overriding it somewhere a reflection probe. Either way, reflection cubemap is the problem, 100%.

Okay, but I don’t really know what to do, I’ve looked at the various project parameters, I’ve tried to change several settings without success.

Could you tell me which elements I should be looking at?

Is skybox changing colors following light rotation change?

Yes, sky is changing color on rotation.
Only the objects remain " lightened ".