Before start let's see the end result.
The main key About Day & Light is to play with Scene's Main Directional Lighting In every scene, I set up one directional light to work as a sun (called mainlight) then I change color, shadowStrenght , and rotate the angle of this light to create a shadow effect
since this game uses a (mostly) fixed isometric camera, I rotate only the X-axis of the light. Y & Z axis is fixed.
![](https://static.wixstatic.com/media/360318_789dba5a030c4e55b3d4c2463e04434d~mv2.png/v1/fill/w_309,h_225,al_c,q_85,enc_auto/360318_789dba5a030c4e55b3d4c2463e04434d~mv2.png)
Morning Time
light in the morning is normally in a cool tone
so we try to lerp* the color from bright yellow to white
we also increase mainlight.shadowStrenght property bit by bit until it reaches 1 by noon
*lerp is a function that will smoothly translate between 2 values. When lerp color value, It's better to lerp within HSV colorspace than an RGB Colorspace to limit the color variation that will appear between transitions.
![](https://static.wixstatic.com/media/360318_0c994881a014458aa8a7989c437d97db~mv2.png/v1/fill/w_255,h_259,al_c,q_85,enc_auto/360318_0c994881a014458aa8a7989c437d97db~mv2.png)
Noon
At noon, we set the mainlight.shadowStrenght to maximum (1) and rotate the light to perpendicular with terrain
![](https://static.wixstatic.com/media/360318_1902969be7c24538966b59a996b14d33~mv2.png/v1/fill/w_267,h_215,al_c,q_85,enc_auto/360318_1902969be7c24538966b59a996b14d33~mv2.png)
Evening
The evening light is warm(orange tone). Decrease the mainlight.shadowStrenght down as the sun goes down
![](https://static.wixstatic.com/media/360318_eb35d270b28949a0b144497113959d58~mv2.png/v1/fill/w_362,h_274,al_c,q_85,enc_auto/360318_eb35d270b28949a0b144497113959d58~mv2.png)
Nighttime
At night I set the light color to dark blue and turn the shadow for the main light off. Now we add some spotlights into the scene to work as a street&Building light
We can divide the lighting into 3 categories 1. Spotlight that creates movement in the scene - just like the light on the shrine roof. We can turn the shadow on to create a dynamic environment that looks more interesting to the player.
2. Spotlight that doesn't create any movement - you can turn shadow off for better performance. 3. Window light - instead of using the real light object, we can use Standard Material's Emission property to create just the brightness. you can compare the 2 images below.
![](https://static.wixstatic.com/media/360318_1eafb3033ba94c2788349849782464f3~mv2.png/v1/fill/w_711,h_397,al_c,q_85,enc_auto/360318_1eafb3033ba94c2788349849782464f3~mv2.png)
![](https://static.wixstatic.com/media/360318_8923361498b74716a62493c8107836cf~mv2.png/v1/fill/w_711,h_393,al_c,q_85,enc_auto/360318_8923361498b74716a62493c8107836cf~mv2.png)
One more thing : When turning on the light, we should add some delay to each light to make sure it doesn't turn on at the same time.
To keep you updated, Please follow me on Twitter: ShibaCode (@ShibaCode) / Twitter Facebook: ShibaCode | Facebook I've just created a Discord server: https://discord.gg/tKBatn2cGD #sushidebtoff #visual
Comments