top of page

Create Day & Night Visual Effect

Updated: Dec 11, 2021

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.

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.


Noon

At noon, we set the mainlight.shadowStrenght to maximum (1) and rotate the light to perpendicular with terrain





Evening

The evening light is warm(orange tone). Decrease the mainlight.shadowStrenght down as the sun goes down





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.


Emission : Off

Emission: On


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

68 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page