wiki.sine.space | sinespace

Day/night cycles

From wiki.sine.space
Revision as of 18:42, 7 November 2016 by JamesStallings (Talk | contribs)

Jump to: navigation, search



Level:

  • Beginner Unity/Space

Goals:

  • Implement Day/Night cycle on a region

This wiki entry describes how to set up day and night on your space region using the Day Night Cycle Script component.

First you will need a directional light to which to attach the script component. Create one, and add the component:


Adddaynightscript.png
Fig. 1: Adding the Day Night Script component to the directional light

By default, the light will be particularly harsh, the cycle will be set to 1440 minutes (a full 24 hr day), will cast no shadows, and have no visible source. This is most likely not what you want, so adjust the light color (a slightly reduced-intensity white tinted slightly orange is a good start), set the day length to something much quicker (15 mins is a good place to set this while tweaking it -- after you have the rest of it configured to your preference, you can then lengthen this out to the desired timeframe).

Next slot your directional light in the 'Sun Light' slot in the Day Night Cycle script component. Toggling the 'Use local System Clock' and 'Shader send time of day' will align your day/night cycle with your real-world local time. I'm uncertain how that will play out if your day length is other than 24 hrs. Finally, if you want to see the sun in the sky, slot the 'Sun' light source type in the 'Flare' slot.

Selecting some type of shadows and adjusting them will produce that effect.

There are additional qualities that one can employ to various ends; I'll leave it to the reader to explore and deploy these according to their needs. This should be a great start however, adding 'outdoor' environmental lighting to your scene.


Lightdetaildaynight.png
Fig. 2: Directional light details

A huge thanks and a shout out to Adam Frisby and the Sinewave team for implementing this feature, and to Adam Frisby for walking me through this such that I could get it done right (and make a wiki entry about it ;)